From: Myungki Lee Date: Mon, 10 Aug 2015 12:59:26 +0000 (+0900) Subject: To fix error handling for _preference_get_key_name func. X-Git-Tag: accepted/tizen/4.0/unified/20170816.011601~6^2~108 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=070f1a0971f7e15f24a8226cfda1356f2004acf7;p=platform%2Fcore%2Fapi%2Fapp-control.git To fix error handling for _preference_get_key_name func. Change-Id: I2d7c49f8f06764f88203997486052f8b8d272830 Signed-off-by: Myungki Lee --- diff --git a/include/app_preference_internal.h b/include/app_preference_internal.h index 1092753..cb670fe 100644 --- a/include/app_preference_internal.h +++ b/include/app_preference_internal.h @@ -57,11 +57,6 @@ extern "C" { #define PREFERENCE_ERROR_WRONG_TYPE -3 /** - * @brief Definition for PREFERENCE_ERROR_OUT_OF_MEMORY. - */ -#define PREFERENCE_ERROR_OUT_OF_MEMORY -12 - -/** * @brief Definition for PREFERENCE_ERROR_FILE_OPEN. */ #define PREFERENCE_ERROR_FILE_OPEN -21 diff --git a/preference/preference.c b/preference/preference.c index 98d4cfa..f11b451 100644 --- a/preference/preference.c +++ b/preference/preference.c @@ -1328,7 +1328,7 @@ API int preference_remove_all(void) ERR("_preference_get_key_name() failed(%d)", ret); _preference_keynode_free(pKeyNode); closedir(dir); - return ret; + return PREFERENCE_ERROR_IO_ERROR; } ret = preference_unset_changed_cb(keyname); @@ -1516,7 +1516,11 @@ API int preference_foreach_item(preference_item_cb callback, void *user_data) snprintf(path, PATH_MAX-1, "%s%s", pref_dir_path, entry); ret = _preference_get_key_name(path, &keyname); - retv_if(ret != PREFERENCE_ERROR_NONE, ret); + if (ret != PREFERENCE_ERROR_NONE) { + ERR("_preference_get_key_name() failed(%d)", ret); + closedir(dir); + return PREFERENCE_ERROR_IO_ERROR; + } callback(keyname, user_data); free(keyname);