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>
This commit is contained in:
lu zhipeng 2022-10-07 10:01:28 +08:00 committed by Laurent Vivier
parent 2d7279984f
commit 4bb5923605

View file

@ -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;
}