From: AlexChen Date: Wed, 26 Aug 2020 10:15:53 +0000 (+0800) Subject: elf2dmp: Fix memory leak on main() error paths X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=885538fdc9e225a502f5da69e15909664308aa93;p=qemu.git elf2dmp: Fix memory leak on main() error paths The 'kdgb' is allocating memory in get_kdbg(), but it is not freed in both fill_header() and fill_context() failed branches, fix it. Signed-off-by: AlexChen Reviewed-by: Li Qiang Reviewed-by: Viktor Prutyanov Reviewed-by: Thomas Huth Message-Id: <5F463659.8080101@huawei.com> Signed-off-by: Laurent Vivier --- diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 9a2dbc2902..ac746e49e0 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -568,12 +568,12 @@ int main(int argc, char *argv[]) if (fill_header(&header, &ps, &vs, KdDebuggerDataBlock, kdbg, KdVersionBlock, qemu_elf.state_nr)) { err = 1; - goto out_pdb; + goto out_kdbg; } if (fill_context(kdbg, &vs, &qemu_elf)) { err = 1; - goto out_pdb; + goto out_kdbg; } if (write_dump(&ps, &header, argv[2])) {