Fix memory leak issue 10/196210/1 submit/tizen/20190104.070559
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 26 Dec 2018 06:46:27 +0000 (15:46 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 26 Dec 2018 06:46:27 +0000 (15:46 +0900)
Change-Id: Idd9b8e6d17a81639f51f0d0e17a99083938f936b
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/ipc/media-thumb-ipc.c

index a127b02..ed5ecb7 100755 (executable)
@@ -81,15 +81,17 @@ int _media_thumb_get_error()
 void __media_thumb_pop()
 {
        int len = 0;
+       int sock = 0;
 
        if (g_manage_queue != NULL) {
                thumbReq *req = (thumbReq *)g_queue_pop_head(g_manage_queue);
                if (req != NULL) {
                        GSource *source_id = g_main_context_find_source_by_id(g_main_context_get_thread_default(), req->source_id);
+                       sock = g_io_channel_unix_get_fd(req->channel);
 
                        g_io_channel_shutdown(req->channel, TRUE, NULL);
                        g_io_channel_unref(req->channel);
-
+                       close(sock);
                        if (source_id != NULL) {
                                g_source_destroy(source_id);
                        } else {
@@ -148,15 +150,17 @@ int __media_thumb_cancel(unsigned int request_id)
 void __media_thumb_pop_raw_data()
 {
        int len = 0;
+       int sock = 0;
 
        if (g_manage_raw_queue != NULL) {
                thumbRawReq *req = (thumbRawReq *)g_queue_pop_head(g_manage_raw_queue);
                if (req != NULL) {
                        GSource *source_id = g_main_context_find_source_by_id(g_main_context_get_thread_default(), req->source_id);
+                       sock = g_io_channel_unix_get_fd(req->channel);
 
                        g_io_channel_shutdown(req->channel, TRUE, NULL);
                        g_io_channel_unref(req->channel);
-
+                       close(sock);
                        if (source_id != NULL) {
                                g_source_destroy(source_id);
                        } else {