projects
/
platform
/
upstream
/
kmod.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2f38000
)
libkmod: kmod_builtin_get_modinfo: free modinfo on error
author
Yauheni Kaliuta
<yauheni.kaliuta@redhat.com>
Sun, 29 Nov 2020 16:47:35 +0000
(18:47 +0200)
committer
Lucas De Marchi
<lucas.demarchi@intel.com>
Tue, 1 Dec 2020 08:44:17 +0000
(
00:44
-0800)
The function allocates array but on building it if get_string()
fails it returns the error leaving the array allocated. The caller
does not care about it in error case either.
Free it to fix memory leak.
Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
libkmod/libkmod-builtin.c
patch
|
blob
|
history
diff --git
a/libkmod/libkmod-builtin.c
b/libkmod/libkmod-builtin.c
index
aaec5dd
..
fc9a376
100644
(file)
--- a/
libkmod/libkmod-builtin.c
+++ b/
libkmod/libkmod-builtin.c
@@
-314,6
+314,7
@@
ssize_t kmod_builtin_get_modinfo(struct kmod_ctx *ctx, const char *modname,
offset = get_string(iter, pos, &line, &linesz);
if (offset <= 0) {
count = (offset) ? -errno : -EOF;
+ free(*modinfo);
goto fail;
}