Fix resource leak
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_pkginfo.c
index 98c5d89..43f2d87 100644 (file)
@@ -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);