From fccddb616688f39af581aaaffc964aab5efa0af4 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Wed, 26 Dec 2018 15:46:27 +0900 Subject: [PATCH] Fix memory leak issue Change-Id: Idd9b8e6d17a81639f51f0d0e17a99083938f936b Signed-off-by: Minje Ahn --- src/ipc/media-thumb-ipc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c index a127b02..ed5ecb7 100755 --- a/src/ipc/media-thumb-ipc.c +++ b/src/ipc/media-thumb-ipc.c @@ -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 { -- 2.7.4