summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorlu zhipeng2022-10-07 04:01:28 +0200
committerLaurent Vivier2022-10-22 23:10:03 +0200
commit4bb5923605b2b8994f933df23aa948efe7ba545c (patch)
treedc7729918238039e89936b809b8137ab29d3da36 /contrib
parenthw/core: Tidy up unnecessary casting away of const (diff)
downloadqemu-4bb5923605b2b8994f933df23aa948efe7ba545c.tar.gz
qemu-4bb5923605b2b8994f933df23aa948efe7ba545c.tar.xz
qemu-4bb5923605b2b8994f933df23aa948efe7ba545c.zip
elf2dmp: free memory in failure
The 'kdgb' is allocating memory in get_kdbg(), but it is not freed in error path. So fix that. Signed-off-by: lu zhipeng <luzhipeng@cestc.cn> Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20221007020128.760-1-luzhipeng@cestc.cn> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/elf2dmp/main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
index b9fc6d230c..d77b8f98f7 100644
--- a/contrib/elf2dmp/main.c
+++ b/contrib/elf2dmp/main.c
@@ -125,6 +125,7 @@ static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb,
if (va_space_rw(vs, KdDebuggerDataBlock, kdbg, kdbg_hdr.Size, 0)) {
eprintf("Failed to extract entire KDBG\n");
+ free(kdbg);
return NULL;
}