From 252f49f2378060446dc22159bae5b00abf2c7c23 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Tue, 9 Jul 2019 18:31:04 +0900 Subject: [PATCH] Fix thread safety issue - Free cb_info at main thread to fix thread safety issue Change-Id: If11ba25c5760a7401f9f3ccf7e8f6bb6a32997e2 Signed-off-by: Junghoon Park --- client/src/pkgmgr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/src/pkgmgr.c b/client/src/pkgmgr.c index 6273ebb..3fba80c 100644 --- a/client/src/pkgmgr.c +++ b/client/src/pkgmgr.c @@ -151,10 +151,19 @@ static struct cb_info *__create_size_info_cb_info( return cb_info; } -static void __free_cb_info(struct cb_info *cb_info) +static gboolean __free_cb_info_at_main_thread(gpointer user_data) { + struct cb_info *cb_info = (struct cb_info *)user_data; + free(cb_info->req_key); free(cb_info); + + return G_SOURCE_REMOVE; +} + +static void __free_cb_info(struct cb_info *cb_info) +{ + g_idle_add(__free_cb_info_at_main_thread, cb_info); } static int __get_size_process(pkgmgr_client *pc, const char *pkgid, uid_t uid, -- 2.34.1