- LOGD("privilege_description = %s", privilege_description);
-
- privilege_info_s* privilege_info = (privilege_info_s*)malloc(sizeof(privilege_info_s));
- memset(privilege_info, 0, sizeof(privilege_info_s));
-
- privilege_info->privilege_name = strdup(privilege_name);
- if (privilege_info->privilege_name == NULL) {
- LOGE("[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- ret = PRVINFO_ERROR_OUT_OF_MEMORY;
- free(privilege_info);
- goto FINISH;
- }
- privilege_info->display_name = strdup(privilege_display);
- if (privilege_info->display_name == NULL) {
- LOGE("[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- ret = PRVINFO_ERROR_OUT_OF_MEMORY;
- free(privilege_info->privilege_name);
- free(privilege_info);
- goto FINISH;
- }
- privilege_info->description = strdup(privilege_description);
- if (privilege_info->description == NULL) {
- LOGE("[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- ret = PRVINFO_ERROR_OUT_OF_MEMORY;
- free(privilege_info->privilege_name);
- free(privilege_info->display_name);
- free(privilege_info);
- goto FINISH;
- }
- LOGI("privilege_info->privilege_name = %s", privilege_info->privilege_name);
- LOGI("privilege_info->display_name = %s", privilege_info->display_name);
- LOGI("privilege_info->description = %s", privilege_info->description);
-
- temp_privilege_info_list = g_list_append(temp_privilege_info_list, privilege_info);
-
- privilege_name_list_size++;
-
- if (privilege_display != NULL) {
- free(privilege_display);
- privilege_display = NULL;
- }
-
- if (privilege_description != NULL) {
- free(privilege_description);
- privilege_description = NULL;
- }
- }
-
- if (is_invaild_parameter_count == privilege_name_list_size)
- consumer_return_code = PRIVILEGE_CONSUMER_RETURN_CODE_INVALID_PARAMETER;
-
-FINISH:
-
- *privilege_info_list = temp_privilege_info_list;
- *return_result = consumer_return_code;
-
- if (privilege_display != NULL) {
- free(privilege_display);
- privilege_display = NULL;
- }
-
- if (privilege_description != NULL) {
- free(privilege_description);
- privilege_description = NULL;
- }
- if (orig_locale != NULL) {
- setlocale(LC_ALL, orig_locale);
- free(orig_locale);
- orig_locale = NULL;
- }
-
- return ret;