From: junsuk77.oh Date: Wed, 8 May 2013 01:29:24 +0000 (+0900) Subject: fix prevent issue X-Git-Tag: accepted/tizen/20130520.100633^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b8054313bc6e2dbf2011e5fdedd8abcb5ef836b0;p=platform%2Fcore%2Fapi%2Fapp-manager.git fix prevent issue Change-Id: Iba04fd1b61f028e2d02fc52ce34aa1049ae8d8f9 Signed-off-by: junsuk77.oh --- diff --git a/packaging/capi-appfw-app-manager.spec b/packaging/capi-appfw-app-manager.spec index 71deffa..77096fc 100755 --- a/packaging/capi-appfw-app-manager.spec +++ b/packaging/capi-appfw-app-manager.spec @@ -1,7 +1,7 @@ Name: capi-appfw-app-manager Summary: Application Manager API Version: 0.1.0 -Release: 21 +Release: 22 Group: API/C API License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/app_info.c b/src/app_info.c index 164a1b7..a2a5047 100755 --- a/src/app_info.c +++ b/src/app_info.c @@ -47,7 +47,6 @@ typedef struct _foreach_context_{ void *user_data; } foreach_context_s; -static char *am_appid; static pkgmgr_client *package_event_listener = NULL; static app_manager_app_info_event_cb app_info_event_cb = NULL; static void *app_info_event_cb_data = NULL; @@ -105,24 +104,13 @@ int app_info_get_app_info(const char *app_id, app_info_h *app_info) return app_info_create(app_id, app_info); } -static int app_info_func(const pkgmgrinfo_appinfo_h handle, void *user_data) -{ - int retval = 0; - - retval = pkgmgr_appinfo_get_appid(handle, &am_appid); - if (retval < 0) { - return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); - } - - return APP_MANAGER_ERROR_NONE; -} - static int app_info_create(const char *app_id, app_info_h *app_info) { pkgmgrinfo_pkginfo_h pkginfo = NULL; pkgmgrinfo_appinfo_h appinfo = NULL; app_info_h info = NULL; int retval = 0; + char *main_appid = NULL; if (app_id == NULL || app_info == NULL) { return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); @@ -135,6 +123,7 @@ static int app_info_create(const char *app_id, app_info_h *app_info) retval = pkgmgrinfo_pkginfo_get_pkginfo(app_id, &pkginfo); if (retval < 0) { if (pkgmgrinfo_appinfo_get_appinfo(app_id, &appinfo)) { + free(info); return app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL); } @@ -144,17 +133,16 @@ static int app_info_create(const char *app_id, app_info_h *app_info) return APP_MANAGER_ERROR_NONE; } - retval = pkgmgrinfo_appinfo_get_list(pkginfo, PM_UI_APP, app_info_func, NULL); - + retval = pkgmgrinfo_pkginfo_get_mainappid(pkginfo, &main_appid); if (retval < 0) { app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL); } - if (pkgmgrinfo_appinfo_get_appinfo(am_appid, &appinfo)) { + if (pkgmgrinfo_appinfo_get_appinfo(main_appid, &appinfo)) { return app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL); } - info->app_id = strdup(am_appid); + info->app_id = strdup(main_appid); info->pkg_app_info = appinfo; *app_info = info;