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));
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));
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));
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));
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));
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));
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));
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.");