Revert modification of error message allocation 69/102769/2 accepted/tizen/3.0/common/20161207.194803 accepted/tizen/3.0/ivi/20161207.013311 accepted/tizen/3.0/mobile/20161207.013212 accepted/tizen/3.0/tv/20161207.013232 accepted/tizen/3.0/wearable/20161207.013252 accepted/tizen/ivi/20161207.030500 accepted/tizen/mobile/20161207.030403 accepted/tizen/tv/20161207.030423 accepted/tizen/wearable/20161207.030441 submit/tizen/20161206.122018 submit/tizen_3.0/20161206.113810
authorYunjin Lee <yunjin-.lee@samsung.com>
Tue, 6 Dec 2016 12:00:50 +0000 (21:00 +0900)
committerYunjin Lee <yunjin-.lee@samsung.com>
Tue, 6 Dec 2016 12:15:04 +0000 (21:15 +0900)
Change-Id: Icbfb12e6a115c5718aecc873678886f1c20ab975
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
capi/src/privilege_manager.c

index 895c844..7d4ae49 100755 (executable)
@@ -328,8 +328,6 @@ int privilege_manager_verify_privilege(uid_t uid, const char *api_version, privi
                        size_t new_size = snprintf(0, 0, "%s%s", noexist_message, message) + 1;
                        char *tmp_message = realloc(noexist_message, new_size * sizeof(char));
                        TryReturn(tmp_message != NULL, ret_val = PRVMGR_ERR_OUT_OF_MEMORY; goto FINISH, PRVMGR_ERR_OUT_OF_MEMORY, "[PRVMGR_ERR_OUT_OF_MEMORY] noexist_message's realloc is failed.");
-                       free(noexist_message);
-                       noexist_message = NULL;
                        noexist_message = tmp_message;
 
                        strncat(noexist_message, message, strlen(message));
@@ -353,8 +351,6 @@ int privilege_manager_verify_privilege(uid_t uid, const char *api_version, privi
                        size_t new_size = snprintf(0, 0, "%s%s", deprecated_message, message) + 1;
                        char *tmp_message = realloc(deprecated_message, new_size * sizeof(char));
                        TryReturn(tmp_message != NULL, ret_val = PRVMGR_ERR_OUT_OF_MEMORY; goto FINISH, PRVMGR_ERR_OUT_OF_MEMORY, "[PRVMGR_ERR_OUT_OF_MEMORY] deprecated_message's realloc is failed.");
-                       free(deprecated_message);
-                       deprecated_message = NULL;
                        deprecated_message = tmp_message;
 
                        strncat(deprecated_message, message, strlen(message));
@@ -379,8 +375,6 @@ int privilege_manager_verify_privilege(uid_t uid, const char *api_version, privi
                                        size_t new_size = snprintf(0, 0, "%s%s", mismatched_message, message) + 1;
                                        char *tmp_message = realloc(mismatched_message, new_size * sizeof(char));
                                        TryReturn(tmp_message != NULL, ret_val = PRVMGR_ERR_OUT_OF_MEMORY; goto FINISH, PRVMGR_ERR_OUT_OF_MEMORY, "[PRVMGR_ERR_OUT_OF_MEMORY] mismatched_message's realloc is failed.");
-                                       free(mismatched_message);
-                                       mismatched_message = NULL;
                                        mismatched_message = tmp_message;
 
                                        strncat(mismatched_message, message, strlen(message));
@@ -401,8 +395,6 @@ int privilege_manager_verify_privilege(uid_t uid, const char *api_version, privi
                                        size_t new_size = snprintf(0, 0, "%s%s", mismatched_message, message) + 1;
                                        char *tmp_message = realloc(mismatched_message, new_size * sizeof(char));
                                        TryReturn(tmp_message, ret_val = PRVMGR_ERR_OUT_OF_MEMORY; goto FINISH, PRVMGR_ERR_OUT_OF_MEMORY, "[PRVMGR_ERR_OUT_OF_MEMORY] mismatched_message's realloc is failed.");
-                                       free(mismatched_message);
-                                       mismatched_message = NULL;
                                        mismatched_message = tmp_message;
 
                                        strncat(mismatched_message, message, strlen(message));
@@ -434,8 +426,6 @@ int privilege_manager_verify_privilege(uid_t uid, const char *api_version, privi
                        size_t new_size = snprintf(0, 0, "%s[NO_EXIST_PRIVILEGE]|%s", message_list, noexist_message) + 1;
                        char *tmp_message_list = realloc(message_list, new_size);
                        TryReturn(tmp_message_list != NULL, ret_val = PRVMGR_ERR_OUT_OF_MEMORY; goto FINISH, PRVMGR_ERR_OUT_OF_MEMORY, "[PRVMGR_ERR_OUT_OF_MEMORY] message_list's realloc is failed.");
-                       free(message_list);
-                       message_list = NULL;
                        message_list = tmp_message_list;
                        strncat(message_list, "[NO_EXIST_PRIVILEGE]|", strlen("[NO_EXIST_PRIVILEGE]|"));
                        strncat(message_list, noexist_message, strlen(noexist_message));
@@ -444,8 +434,6 @@ int privilege_manager_verify_privilege(uid_t uid, const char *api_version, privi
                        size_t new_size = snprintf(0, 0, "%s[DEPRECATED_PRIVILEGE]|%s", message_list, deprecated_message) + 1;
                        char *tmp_message_list = realloc(message_list, new_size);
                        TryReturn(tmp_message_list != NULL, ret_val = PRVMGR_ERR_OUT_OF_MEMORY; goto FINISH, PRVMGR_ERR_OUT_OF_MEMORY, "[PRVMGR_ERR_OUT_OF_MEMORY] message_list's realloc is failed.");
-                       free(message_list);
-                       message_list = NULL;
                        message_list = tmp_message_list;
                        strncat(message_list, "[DEPRECATED_PRIVILEGE]|", strlen("[DEPRECATED_PRIVILEGE]|"));
                        strncat(message_list, deprecated_message, strlen(deprecated_message));
@@ -454,8 +442,6 @@ int privilege_manager_verify_privilege(uid_t uid, const char *api_version, privi
                        size_t new_size = snprintf(0, 0, "%s[MISMATCHED_PRIVILEGE_LEVEL]|%s", message_list, mismatched_message) + 1;
                        char *tmp_message_list = realloc(message_list, new_size);
                        TryReturn(tmp_message_list != NULL, ret_val = PRVMGR_ERR_OUT_OF_MEMORY; goto FINISH, PRVMGR_ERR_OUT_OF_MEMORY, "[PRVMGR_ERR_OUT_OF_MEMORY] message_list's realloc is failed.");
-                       free(message_list);
-                       message_list = NULL;
                        message_list = tmp_message_list;
                        strncat(message_list, "[MISMATCHED_PRIVILEGE_LEVEL]|", strlen("[MISMATCHED_PRIVILEGE_LEVEL]|"));
                        strncat(message_list, mismatched_message, strlen(mismatched_message));
@@ -464,8 +450,6 @@ int privilege_manager_verify_privilege(uid_t uid, const char *api_version, privi
                char* tmp_message_list = realloc(message_list, total_size);
                TryReturn(tmp_message_list != NULL, ret_val = PRVMGR_ERR_OUT_OF_MEMORY; goto FINISH, PRVMGR_ERR_OUT_OF_MEMORY, "[PRVMGR_ERR_OUT_OF_MEMORY] message_list's realloc is failed.");
                message_list = tmp_message_list;
-               free(message_list);
-               message_list = NULL;
                strncat(message_list, newline, strlen(newline));
                *error_message = strdup(message_list);
                TryReturn(error_message != NULL, ret_val = PRVMGR_ERR_OUT_OF_MEMORY; goto FINISH, PRVMGR_ERR_OUT_OF_MEMORY, "[PRVMGR_ERR_OUT_OF_MEMORY] error_message's strdup is failed.");