(task_content.c) Cleanups - extraction error message was not being

printed
This commit is contained in:
twinaphex 2019-05-22 04:24:19 +02:00
parent 04110576ea
commit 138a070ceb

View File

@ -420,6 +420,7 @@ static bool load_content_from_compressed_archive(
fill_pathname_join(new_path, new_basedir, fill_pathname_join(new_path, new_basedir,
path_basename(path), new_path_size); path_basename(path), new_path_size);
free(new_basedir);
ret = file_archive_compressed_read(path, ret = file_archive_compressed_read(path,
NULL, new_path, &new_path_len); NULL, new_path, &new_path_len);
@ -435,25 +436,21 @@ static bool load_content_from_compressed_archive(
path); path);
*error_string = strdup(str); *error_string = strdup(str);
free(str); free(str);
goto error; free(new_path);
return false;
} }
string_list_append(additional_path_allocs, new_path, attributes); string_list_append(additional_path_allocs, new_path, attributes);
info[i].path = info[i].path =
additional_path_allocs->elems[additional_path_allocs->size - 1].data; additional_path_allocs->elems[additional_path_allocs->size - 1].data;
free(new_path);
if (!string_list_append(content_ctx->temporary_content, if (!string_list_append(content_ctx->temporary_content,
new_path, attributes)) new_path, attributes))
goto error; return false;
free(new_basedir);
free(new_path);
return true; return true;
error:
free(new_basedir);
free(new_path);
return false;
} }
/* Try to extract all content we're going to load if appropriate. */ /* Try to extract all content we're going to load if appropriate. */
@ -516,9 +513,11 @@ static bool content_file_init_extract(
msg_hash_to_str( msg_hash_to_str(
MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE), MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE),
temp_content); temp_content);
*error_string = strdup(str);
free(temp_content); free(temp_content);
free(str); free(str);
goto error; free(new_path);
return false;
} }
string_list_set(content, i, new_path); string_list_set(content, i, new_path);
@ -527,17 +526,16 @@ static bool content_file_init_extract(
if (!string_list_append(content_ctx->temporary_content, if (!string_list_append(content_ctx->temporary_content,
new_path, *attr)) new_path, *attr))
goto error; {
free(new_path);
return false;
}
free(new_path); free(new_path);
} }
} }
return true; return true;
error:
free(new_path);
return false;
} }
#endif #endif