Fix invalid memory usage bug causing invalid free
realloc(...) was not used propertly. The number of items to be reallocated was specified, but not the size of each item.
This commit is contained in:
parent
44080e85cc
commit
21752fb504
1 changed files with 1 additions and 1 deletions
|
@ -116,7 +116,7 @@ int simple_archiver_parse_args(int argc, const char **argv,
|
||||||
|
|
||||||
// TODO verify this is necessary, using different variables.
|
// TODO verify this is necessary, using different variables.
|
||||||
ptr = out->working_files;
|
ptr = out->working_files;
|
||||||
out->working_files = realloc(ptr, working_size + 1);
|
out->working_files = realloc(ptr, sizeof(char*) * (working_size + 1));
|
||||||
|
|
||||||
// Set new actual last element to NULL.
|
// Set new actual last element to NULL.
|
||||||
out->working_files[working_size] = NULL;
|
out->working_files[working_size] = NULL;
|
||||||
|
|
Loading…
Reference in a new issue