diff options
author | Seung-Woo Kim <sw0312.kim@samsung.com> | 2021-04-09 18:44:23 +0900 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2021-04-12 10:24:01 +0900 |
commit | 4fc543f0c31acb29d9b2f951e79f4c997536b2c5 (patch) | |
tree | 86936878ddf30d4bf4873d7645cd9149c43b857f | |
parent | a62b5b70983225a86e7cd3c1f4280409683e1b72 (diff) | |
download | kmod-4fc543f0c31acb29d9b2f951e79f4c997536b2c5.tar.gz kmod-4fc543f0c31acb29d9b2f951e79f4c997536b2c5.tar.bz2 kmod-4fc543f0c31acb29d9b2f951e79f4c997536b2c5.zip |
libkmod-config: fix a memory leak when kmod_list_append() failssubmit/tizen/20210412.054957accepted/tizen/unified/20210413.021236
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>
[sw0312.kim: cherry-pick mainline commit 39dd17162374]
Change-Id: Ic1d1e77ecc9b81fdd4f0eb771cce1d7b42d0024e
-rw-r--r-- | libkmod/libkmod-config.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c index 971f20b..90e3e94 100644 --- a/libkmod/libkmod-config.c +++ b/libkmod/libkmod-config.c @@ -854,8 +854,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; } |