]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
elf2dmp: Fix memory leak on main() error paths
authorAlexChen <alex.chen@huawei.com>
Wed, 26 Aug 2020 10:15:53 +0000 (18:15 +0800)
committerLaurent Vivier <laurent@vivier.eu>
Tue, 27 Oct 2020 15:48:40 +0000 (16:48 +0100)
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 <alex.chen@huawei.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <5F463659.8080101@huawei.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
contrib/elf2dmp/main.c

index 9a2dbc290214bc56fa02b077f3afdaed8216fc54..ac746e49e097c2e11f5a9c1eb715ed91d00deb8f 100644 (file)
@@ -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])) {