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>
l = kmod_list_append(free_list, root);
if (l == NULL) {
ERR("No memory to report cycles\n");
+ free(root);
goto out;
}
free_list = l;
l = kmod_list_append(free_list, v);
if (l == NULL) {
ERR("No memory to report cycles\n");
+ free(v);
goto out;
}
free_list = l;