From a4d49e8b58bbf6c3572f363d33fe2db7dc73b7bc Mon Sep 17 00:00:00 2001 From: Kai Song Date: Wed, 29 Sep 2021 16:11:57 +0800 Subject: Add some necessary free() calls free should be called before the function exit abnormally. Signed-off-by: Kai Song Signed-off-by: Simon Horman --- util_lib/elf_info.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'util_lib') diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c index 676926c..51d8b92 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); -- cgit