From 02991b5cec1502ea840af6e983e82113bb7bb316 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Mon, 8 May 2017 10:56:08 +0900 Subject: [PATCH] Fix pkg update info - Fix memory leak - Fix to return error when failed to push into queue Change-Id: I010dadd4cf55f1ecf433a5f953e897e39d27dcdb Signed-off-by: Junghyun Yeon --- src/request.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/request.c b/src/request.c index e2ea9c6..b9db7e0 100644 --- a/src/request.c +++ b/src/request.c @@ -758,6 +758,7 @@ static int __handle_request_register_pkg_update_info( pkgmgrinfo_updateinfo_destroy(update_info); g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", PKGMGR_R_ESYSTEM)); + free(reqkey); return -1; } if (!g_hash_table_insert(req_table, (gpointer)reqkey, @@ -817,9 +818,12 @@ static int __handle_request_unregister_pkg_update_info( if (_push_queue(target_uid, caller_uid, reqkey, REQUEST_TYPE_UNREGISTER_PKG_UPDATE_INFO, "default", - pkgid, NULL, NULL)) + pkgid, NULL, NULL)) { g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", PKGMGR_R_ESYSTEM)); + free(reqkey); + return -1; + } if (!g_hash_table_insert(req_table, (gpointer)reqkey, (gpointer)invocation)) @@ -853,9 +857,12 @@ static int __handle_request_unregister_all_pkg_update_info( if (_push_queue(target_uid, caller_uid, reqkey, REQUEST_TYPE_UNREGISTER_ALL_PKG_UPDATE_INFO, "default", - NULL, NULL, NULL)) + NULL, NULL, NULL)) { g_dbus_method_invocation_return_value(invocation, g_variant_new("(is)", PKGMGR_R_ESYSTEM, "")); + free(reqkey); + return -1; + } if (!g_hash_table_insert(req_table, (gpointer)reqkey, (gpointer)invocation)) -- 2.7.4