From: Junghyun Yeon Date: Tue, 25 Apr 2017 01:44:44 +0000 (+0900) Subject: Fix behavior of register update info X-Git-Tag: accepted/tizen/unified/20170428.033036~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fappfw%2Fpkgmgr-server.git;a=commitdiff_plain;h=591920a47beddb62fd829e37593e045724ec5996 Fix behavior of register update info - Fix memory leak - It will return error when failed to push into queue Change-Id: I913e3c655b1182700429e263bc8fd19e9c5e8f94 Signed-off-by: Junghyun Yeon --- diff --git a/src/request.c b/src/request.c index f1993ca..e2ea9c6 100644 --- a/src/request.c +++ b/src/request.c @@ -724,6 +724,7 @@ static int __handle_request_register_pkg_update_info( if (ret != PMINFO_R_OK) { g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", PKGMGR_R_ENOMEM)); + pkgmgrinfo_updateinfo_destroy(update_info); return -1; } @@ -731,6 +732,7 @@ static int __handle_request_register_pkg_update_info( if (ret != PMINFO_R_OK) { g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", PKGMGR_R_ENOMEM)); + pkgmgrinfo_updateinfo_destroy(update_info); return -1; } @@ -738,11 +740,13 @@ static int __handle_request_register_pkg_update_info( if (ret != PMINFO_R_OK) { g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", PKGMGR_R_ENOMEM)); + pkgmgrinfo_updateinfo_destroy(update_info); return -1; } reqkey = __generate_reqkey("register_pkg_update_info"); if (reqkey == NULL) { + pkgmgrinfo_updateinfo_destroy(update_info); g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", PKGMGR_R_ENOMEM)); return -1; @@ -750,10 +754,12 @@ static int __handle_request_register_pkg_update_info( if (_push_queue(target_uid, caller_uid, reqkey, REQUEST_TYPE_REGISTER_PKG_UPDATE_INFO, "default", - NULL, buf, update_info)) + NULL, buf, update_info)) { + pkgmgrinfo_updateinfo_destroy(update_info); g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", PKGMGR_R_ESYSTEM)); - + return -1; + } if (!g_hash_table_insert(req_table, (gpointer)reqkey, (gpointer)invocation)) ERR("reqkey already exists");