Merge pull request #5054 from evverx/fix-double-free-in-link
shared: fix double free in link
This commit is contained in:
commit
4a04597ac8
|
@ -1893,7 +1893,11 @@ int unit_file_unmask(
|
|||
if (!GREEDY_REALLOC0(todo, n_allocated, n_todo + 2))
|
||||
return -ENOMEM;
|
||||
|
||||
todo[n_todo++] = strdup(*i);
|
||||
todo[n_todo] = strdup(*i);
|
||||
if (!todo[n_todo])
|
||||
return -ENOMEM;
|
||||
|
||||
n_todo++;
|
||||
}
|
||||
|
||||
strv_uniq(todo);
|
||||
|
@ -1941,7 +1945,7 @@ int unit_file_link(
|
|||
unsigned *n_changes) {
|
||||
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
_cleanup_free_ char **todo = NULL;
|
||||
_cleanup_strv_free_ char **todo = NULL;
|
||||
size_t n_todo = 0, n_allocated = 0;
|
||||
const char *config_path;
|
||||
char **i;
|
||||
|
@ -1990,7 +1994,11 @@ int unit_file_link(
|
|||
if (!GREEDY_REALLOC0(todo, n_allocated, n_todo + 2))
|
||||
return -ENOMEM;
|
||||
|
||||
todo[n_todo++] = *i;
|
||||
todo[n_todo] = strdup(*i);
|
||||
if (!todo[n_todo])
|
||||
return -ENOMEM;
|
||||
|
||||
n_todo++;
|
||||
}
|
||||
|
||||
strv_uniq(todo);
|
||||
|
|
Loading…
Reference in a new issue