mirror of
https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
synced 2024-11-26 21:33:42 +08:00
depmod: Release memory on error paths
If a list node could not be added, release already allocated data which was supposed to end up in list. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> Link: https://github.com/kmod-project/kmod/pull/228 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
This commit is contained in:
parent
63aec6095b
commit
da0ee2217d
@ -1867,6 +1867,7 @@ static int depmod_report_cycles_from_root(struct depmod *depmod, struct mod *roo
|
||||
l = kmod_list_append(free_list, root);
|
||||
if (l == NULL) {
|
||||
ERR("No memory to report cycles\n");
|
||||
free(root);
|
||||
goto out;
|
||||
}
|
||||
free_list = l;
|
||||
@ -1922,6 +1923,7 @@ static int depmod_report_cycles_from_root(struct depmod *depmod, struct mod *roo
|
||||
l = kmod_list_append(free_list, v);
|
||||
if (l == NULL) {
|
||||
ERR("No memory to report cycles\n");
|
||||
free(v);
|
||||
goto out;
|
||||
}
|
||||
free_list = l;
|
||||
|
Loading…
Reference in New Issue
Block a user