From: jinbong, Lee Date: Tue, 29 Aug 2023 10:56:54 +0000 (+0900) Subject: Remove double free situation X-Git-Tag: accepted/tizen/unified/20230830.170620~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3e34cc9dc656a82a430b7f93aeeb5f4058664e8;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git Remove double free situation - if (source->fd_type == FD_TYPE_FENCE && source->type == SOURCE_TYPE_DISPOSABLE) then g_source_remove_unix_fd, g_source_destroy, g_source_unref is called twice for source->gsource. - it can cause error like that free already freed memory or free with invalid pointer (garbage value) Change-Id: I44e3b1d50b0710d9cd2ddcf8e8c8f4215acff344 --- diff --git a/src/tpl_utils_gthread.c b/src/tpl_utils_gthread.c index e9f506b..b4b78cf 100644 --- a/src/tpl_utils_gthread.c +++ b/src/tpl_utils_gthread.c @@ -365,7 +365,8 @@ tpl_gsource_destroy(tpl_gsource *source, tpl_bool_t destroy_in_thread) g_source_destroy(&source->gsource); g_source_unref(&source->gsource); } - __gsource_remove_and_destroy(source); + else + __gsource_remove_and_destroy(source); } g_mutex_unlock(&thread->thread_mutex);