aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlu zhipeng <luzhipeng@cestc.cn>2022-10-07 10:01:28 +0800
committerLaurent Vivier <laurent@vivier.eu>2022-10-22 23:10:03 +0200
commit4bb5923605b2b8994f933df23aa948efe7ba545c (patch)
treedc7729918238039e89936b809b8137ab29d3da36
parent2d7279984fdf735fb80f32e5a09f777e4188c57e (diff)
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>
-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;
}