int PkgmgrAppInfoCallback(const pkgmgrinfo_appinfo_h handle,
void *user_data) {
manifest_x* mfx = static_cast<manifest_x*>(user_data);
- application_x* application =
- static_cast<application_x*>(calloc(1, sizeof(application_x)));
- if (!application)
- return PMINFO_R_ERROR;
char* app_id = nullptr;
- if (pkgmgrinfo_appinfo_get_appid(handle, &app_id)) {
- free(application);
+ if (pkgmgrinfo_appinfo_get_appid(handle, &app_id))
return PMINFO_R_ERROR;
- }
char* icon_text = nullptr;
if (pkgmgrinfo_appinfo_get_icon(handle, &icon_text))
if (!mfx->root_path) {
char *root_path = nullptr;
- if (pkgmgrinfo_appinfo_get_root_path(handle, &root_path)) {
- free(application);
+ if (pkgmgrinfo_appinfo_get_root_path(handle, &root_path))
return PMINFO_R_ERROR;
- }
mfx->root_path = strdup(root_path);
}
- application->appid = strdup(app_id);
+ application_x* application =
+ static_cast<application_x*>(calloc(1, sizeof(application_x)));
+ if (!application)
+ return PMINFO_R_ERROR;
+
if (icon_text) {
icon_x* icon = static_cast<icon_x*>(calloc(1, sizeof(icon_x)));
if (!icon) {
icon->text = strdup(icon_text);
application->icon = g_list_append(application->icon, icon);
}
+ application->appid = strdup(app_id);
mfx->application = g_list_append(mfx->application, application);
return PMINFO_R_OK;