From: sooyeon Date: Mon, 15 Apr 2024 07:34:36 +0000 (+0900) Subject: Add g_steal_pointer to avoid double-free X-Git-Tag: accepted/tizen/unified/20240611.123502~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F32%2F311532%2F1;p=platform%2Fcore%2Fuifw%2Ftts.git Add g_steal_pointer to avoid double-free Change-Id: I9e755e7fd34f2f3b426303683833707a07a899fd Signed-off-by: sooyeon (cherry picked from commit 1f94e6693848154ae8d802215cb927584853b59d) --- diff --git a/client/tts_tidl.c b/client/tts_tidl.c index 17ecfef..31f0be6 100644 --- a/client/tts_tidl.c +++ b/client/tts_tidl.c @@ -159,6 +159,7 @@ static void __notify_cb(void *user_data, int pid, int uid, bundle *msg) static void destroy_scheduled_handle(gpointer data) { rpc_port_proxy_tts_h rpc_h = (rpc_port_proxy_tts_h)data; + SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Destroy rpc handle(%p)", rpc_h); int ret = rpc_port_proxy_tts_destroy(rpc_h); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to destroy handle. ret(%d/%s)", ret, get_error_message(ret)); @@ -168,7 +169,7 @@ static void destroy_scheduled_handle(gpointer data) static Eina_Bool destroy_scheduled_handles_by_ecore_idler(void *user_data) { SLOG(LOG_INFO, TAG_TTSC, "[INFO] Destroy RPC handles those are scheduled to be destroyed."); - g_slist_free_full(g_destruction_scheduled_handles, destroy_scheduled_handle); + g_slist_free_full(g_steal_pointer(&g_destruction_scheduled_handles), destroy_scheduled_handle); g_destruction_scheduled_handles = NULL; g_destroy_handles_idler = NULL; @@ -301,7 +302,7 @@ int tts_tidl_close_connection(unsigned int uid) g_destroy_handles_idler = NULL; } - g_slist_free_full(g_destruction_scheduled_handles, destroy_scheduled_handle); + g_slist_free_full(g_steal_pointer(&g_destruction_scheduled_handles), destroy_scheduled_handle); g_destruction_scheduled_handles = NULL; free(info->engine_app_id);