summaryrefslogtreecommitdiffstats
path: root/util_lib
diff options
context:
space:
mode:
authorKai Song <songkai01@inspur.com>2021-09-29 16:11:57 +0800
committerSimon Horman <horms@verge.net.au>2021-10-05 10:29:17 +0200
commita4d49e8b58bbf6c3572f363d33fe2db7dc73b7bc (patch)
tree7e6a5b32d642ecf226af910bf3682d836afaada4 /util_lib
parentbcee4f232e443053e1f6b9297716cad2488f7322 (diff)
downloadkexec-tools-a4d49e8b58bbf6c3572f363d33fe2db7dc73b7bc.tar.gz
Add some necessary free() calls
free should be called before the function exit abnormally. Signed-off-by: Kai Song <songkai01@inspur.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'util_lib')
-rw-r--r--util_lib/elf_info.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c
index 676926ca..51d8b926 100644
--- a/util_lib/elf_info.c
+++ b/util_lib/elf_info.c
@@ -605,8 +605,10 @@ static int scan_notes(int fd, loff_t start, loff_t lsize)
scan_vmcoreinfo(n_desc, n_descsz);
}
- if ((note + sizeof(Elf_Nhdr)) == last)
+ if ((note + sizeof(Elf_Nhdr)) == last) {
+ free(buf);
return -1;
+ }
free(buf);