mirror of
https://github.com/AuxXxilium/kmod.git
synced 2024-11-23 23:10:53 +07:00
libkmod-config: fix a memory leak when kmod_list_append() fails
From kmod_config_new(), when kmod_list_append() fails, fix not list-appended kmod_config_path leak. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
This commit is contained in:
parent
8742be0aa5
commit
39dd171623
@ -909,8 +909,10 @@ int kmod_config_new(struct kmod_ctx *ctx, struct kmod_config **p_config,
|
||||
memcpy(cf->path, path, pathlen);
|
||||
|
||||
tmp = kmod_list_append(path_list, cf);
|
||||
if (tmp == NULL)
|
||||
if (tmp == NULL) {
|
||||
free(cf);
|
||||
goto oom;
|
||||
}
|
||||
path_list = tmp;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user