diff options
author | Yunjin Lee <yunjin-.lee@samsung.com> | 2022-01-17 18:19:40 +0900 |
---|---|---|
committer | Yunjin Lee <yunjin-.lee@samsung.com> | 2022-01-17 18:19:40 +0900 |
commit | 141e35fbe4f3e9b3d9f6165fdca34a049a61df4b (patch) | |
tree | deb830c570517be975b936d2748efa731a99ab00 | |
parent | 6420eaf2d79dd889d67bb8b7697a574f51465785 (diff) | |
download | privacy-setting-141e35fbe4f3e9b3d9f6165fdca34a049a61df4b.tar.gz privacy-setting-141e35fbe4f3e9b3d9f6165fdca34a049a61df4b.tar.bz2 privacy-setting-141e35fbe4f3e9b3d9f6165fdca34a049a61df4b.zip |
Fix resource leak and potential crash
Change-Id: Id593b90c637914789f4fbd8a528193670726e1b2
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
-rw-r--r-- | ui-popup/src/popup.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ui-popup/src/popup.c b/ui-popup/src/popup.c index 74af91f..59dfbf8 100644 --- a/ui-popup/src/popup.c +++ b/ui-popup/src/popup.c @@ -174,17 +174,20 @@ static char* __get_pkg_label(const char* pkgid) int ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); if (ret != PMINFO_R_OK) { LOGE("pkgmgrinfo_pkginfo_get_pkginfo() failed. ret = %d, pkgid = %s", ret, pkgid); - return ""; + pkgmgrinfo_pkginfo_destroy_pkginfo(handle); + return strdup(""); } ret = pkgmgrinfo_pkginfo_get_label(handle, &label); if (ret != PMINFO_R_OK) { LOGE("pkgmgrinfo_pkginfo_get_label() failed. ret = %d, pkgid = %s", ret, pkgid); - return ""; + pkgmgrinfo_pkginfo_destroy_pkginfo(handle); + return strdup(""); } char* pkg_label = strdup(label); if (pkg_label == NULL) { LOGE("strdup() of pkg_label failed. pkgid = %s", pkgid); - return ""; + pkgmgrinfo_pkginfo_destroy_pkginfo(handle); + return strdup(""); } pkgmgrinfo_pkginfo_destroy_pkginfo(handle); |