elf2dmp/qemu_elf: Plug memleak in QEMU_Elf_init
authorPan Nengyuan <pannengyuan@huawei.com>
Fri, 23 Oct 2020 06:12:14 +0000 (14:12 +0800)
committerLaurent Vivier <laurent@vivier.eu>
Sun, 13 Dec 2020 22:56:16 +0000 (23:56 +0100)
Missing g_error_free in QEMU_Elf_init() error path. Fix that.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201023061218.2080844-4-kuhn.chenqun@huawei.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
contrib/elf2dmp/qemu_elf.c

index 0db781658628a0005f8bb29f72ab1e14e2c28feb..b601b6d7ba44802f0ac6103b564d4fcd30766a38 100644 (file)
@@ -126,6 +126,7 @@ int QEMU_Elf_init(QEMU_Elf *qe, const char *filename)
     qe->gmf = g_mapped_file_new(filename, TRUE, &gerr);
     if (gerr) {
         eprintf("Failed to map ELF dump file \'%s\'\n", filename);
+        g_error_free(gerr);
         return 1;
     }