From: lu zhipeng Date: Fri, 7 Oct 2022 02:01:28 +0000 (+0800) Subject: elf2dmp: free memory in failure X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4bb5923605b2b8994f933df23aa948efe7ba545c;p=qemu.git 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 Reviewed-by: Viktor Prutyanov Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20221007020128.760-1-luzhipeng@cestc.cn> Signed-off-by: Laurent Vivier --- 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; }