Fix resource leak
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_appinfo.c
index a826ec3..da7d2ac 100644 (file)
@@ -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);