From: Myungki Lee Date: Wed, 27 Jan 2016 03:18:02 +0000 (+0900) Subject: Do not use create function when app_info clone X-Git-Tag: accepted/tizen/mobile/20160202.114609~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eac36e68b61823475591aee0478e42bd714eac9f;p=platform%2Fcore%2Fapi%2Fapp-manager.git Do not use create function when app_info clone Change-Id: I9ba9a475a79cf763ee26203b261cdfd6c473b302 Signed-off-by: Myungki Lee --- diff --git a/src/app_info.c b/src/app_info.c index 41f492d..cd86ba3 100644 --- a/src/app_info.c +++ b/src/app_info.c @@ -516,15 +516,28 @@ API int app_info_is_preload(app_info_h app_info, bool *preload) API int app_info_clone(app_info_h *clone, app_info_h app_info) { - int retval; + app_info_h info; if (clone == NULL || app_info == NULL) return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); - retval = app_info_create(app_info->app_id, clone); + info = calloc(1, sizeof(struct app_info_s)); + if (info == NULL) + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + + info->app_id = strdup(app_info->app_id); + if (info->app_id == NULL) { + free(info); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + } + + if (pkgmgrinfo_appinfo_clone_appinfo(app_info->pkg_app_info, &(info->pkg_app_info)) < 0) { + free(info->app_id); + free(info); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + } - if (retval != APP_MANAGER_ERROR_NONE) - return app_manager_error(retval, __FUNCTION__, NULL); + *clone = info; return APP_MANAGER_ERROR_NONE; }