Fix static analysis issue
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_appinfo.c
index ad93c86..b50e08d 100644 (file)
@@ -786,8 +786,21 @@ static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid,
        }
 
        info->app_info = (application_x *)g_hash_table_lookup(list, appid);
+       if (!info->app_info || !info->app_info->package) {
+               _LOGD("appinfo for [%s] is not existed for user [%d]",
+                               appid, uid);
+               g_hash_table_destroy(list);
+               free(locale);
+               return PMINFO_R_ENOENT;
+       }
        info->locale = locale;
        info->package = strdup(info->app_info->package);
+       if (!info->package) {
+               _LOGE("out of memory");
+               g_hash_table_destroy(list);
+               free(locale);
+               return PMINFO_R_ERROR;
+       }
 
        /* just free list only */
        g_hash_table_steal(list, (gconstpointer)appid);