From: junkyu han Date: Tue, 26 Sep 2017 10:15:23 +0000 (+0900) Subject: Fixed Svace Issue X-Git-Tag: accepted/tizen/unified/20180323.062136^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d64afa432860af7bc517e56371217297c0104d1f;p=apps%2Fnative%2Fmenu-screen.git Fixed Svace Issue Change-Id: Id5e7b15af157b5ecd7ec8ac0d59a190d41acb6d2 --- diff --git a/src/pkgmgr.c b/src/pkgmgr.c index e54673c..4e9252a 100644 --- a/src/pkgmgr.c +++ b/src/pkgmgr.c @@ -147,21 +147,28 @@ HAPI menu_screen_error_e pkgmgr_uninstall(Evas_Object *item) if (package_manager_request_create(&request) != PACKAGE_MANAGER_ERROR_NONE) { _E("Failed to create request for %s", pkgid); - return MENU_SCREEN_ERROR_FAIL; + goto ERROR; } if (package_manager_request_set_mode(request, PACKAGE_MANAGER_REQUEST_MODE_DEFAULT)) { _E("Failed to set request mode for %s", pkgid); - return MENU_SCREEN_ERROR_FAIL; + goto ERROR; } if (package_manager_request_uninstall(request, pkgid, &id)) { _E("Failed to request uninstall for %s", pkgid); + goto ERROR; } package_manager_request_destroy(request); return MENU_SCREEN_ERROR_OK; + +ERROR: + if (request) + package_manager_request_destroy(request); + + return MENU_SCREEN_ERROR_FAIL; } @@ -313,6 +320,9 @@ static bool _pkgmgr_get_apps_info(app_info_h app_handle, app_list_item **item) if (app_info->icon) free(app_info->icon); app_info->icon = malloc(MAX_FILE_PATH_LEN); + if (!app_info->icon) + goto ERROR; + const char *path = util_get_res_file_path(IMAGE_DIR"default_app_icon.png"); snprintf(app_info->icon, MAX_FILE_PATH_LEN, "%s", path); } @@ -352,9 +362,13 @@ static bool _pkgmgr_get_apps_info(app_info_h app_handle, app_list_item **item) _D("[ALL Apps] package=%s", new_item->package); + package_info_destroy(p_handle); + return true; ERROR: + if (p_handle) + package_info_destroy(p_handle); if (app_info && app_info->name) free(app_info->name); if (app_info && app_info->icon)