Allocates the memory of epoll events dynamically 13/269413/1 accepted/tizen/unified/20220117.134949 submit/tizen/20220114.040901
authorSeonah Moon <seonah1.moon@samsung.com>
Fri, 14 Jan 2022 02:41:32 +0000 (11:41 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Fri, 14 Jan 2022 02:41:38 +0000 (11:41 +0900)
Change-Id: Ic657c08e495eeeac2091d5a24854dfc95f1b6a8d

packaging/capi-network-vine.spec
src/vine-event-loop-epoll.cpp

index 0834c6d..fb39f98 100755 (executable)
@@ -3,7 +3,7 @@
 %bcond_without use_glib_event_loop
 Name:    capi-network-vine
 Summary: An service discovery framework
-Version: 1.2.6
+Version: 1.2.7
 Release: 0
 Group:   Network & Connectivity/API
 License: Apache-2.0
index fac6f80..0747ee2 100755 (executable)
@@ -62,7 +62,13 @@ static void *__vine_event_loop_epoll_run(void *arg)
 {
        VINE_LOGD("Run Vine event loop");
 
-       struct epoll_event events[MAX_VINE_FDS];
+       struct epoll_event *events
+               = (struct epoll_event *)calloc(MAX_VINE_FDS, sizeof(struct epoll_event));
+       if (events == NULL) {
+               VINE_LOGE("calloc() fails.");
+               return NULL;
+       }
+
        int timeout = -1;
 
        do {
@@ -79,6 +85,8 @@ static void *__vine_event_loop_epoll_run(void *arg)
                }
        } while (!__cleanup);
 
+       free(events);
+
        // TODO:
        // Even although __cleanup is set as false,
        // this loop cannot be broken if waiting epoll_wait()