From: Junghoon Park Date: Tue, 26 Sep 2017 08:10:40 +0000 (+0900) Subject: Fix resource leak X-Git-Tag: accepted/tizen/4.0/unified/20170929.080335~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F90%2F152490%2F1;hp=0199975f8b4417de0c05bd7fb9684b70f4e42be8;p=platform%2Fcore%2Fappfw%2Fpkgmgr-info.git Fix resource leak Change-Id: I35851682a958f42dfbf1492b4a424381f6b4ed87 Signed-off-by: Junghoon Park --- diff --git a/src/pkgmgrinfo_appinfo.c b/src/pkgmgrinfo_appinfo.c index a826ec3..da7d2ac 100644 --- a/src/pkgmgrinfo_appinfo.c +++ b/src/pkgmgrinfo_appinfo.c @@ -733,6 +733,12 @@ static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid, ret = _appinfo_get_applications(GLOBAL_USER, uid, locale, filter, PMINFO_APPINFO_GET_ALL, list); + if (ret != PMINFO_R_OK) { + g_hash_table_destroy(list); + free(locale); + return ret; + } + if (!g_hash_table_size(list)) { _LOGD("appinfo for [%s] is not existed for user [%d]", appid, uid); diff --git a/src/pkgmgrinfo_pkginfo.c b/src/pkgmgrinfo_pkginfo.c index 98c5d89..43f2d87 100644 --- a/src/pkgmgrinfo_pkginfo.c +++ b/src/pkgmgrinfo_pkginfo.c @@ -711,6 +711,12 @@ static int _pkgmgrinfo_get_pkginfo(const char *pkgid, uid_t uid, ret = _pkginfo_get_packages(GLOBAL_USER, locale, filter, PMINFO_PKGINFO_GET_ALL, list); + if (ret != PMINFO_R_OK) { + g_hash_table_destroy(list); + free(locale); + return ret; + } + if (!g_hash_table_size(list)) { _LOGD("pkginfo for [%s] is not existed for user [%d]", pkgid, uid);