qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* elf2dmp: Fix memory leak on main() error paths
@ 2020-08-26 10:15 AlexChen
  2020-09-04  1:04 ` AlexChen
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: AlexChen @ 2020-08-26 10:15 UTC (permalink / raw)
  To: Viktor Prutyanov; +Cc: zhengchuan, qemu-devel, zhang.zhanghailiang

From: AlexChen <alex.chen@huawei.com>

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>
---
 contrib/elf2dmp/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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])) {
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-11  7:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-26 10:15 elf2dmp: Fix memory leak on main() error paths AlexChen
2020-09-04  1:04 ` AlexChen
2020-09-07  1:24 ` Li Qiang
2020-09-10 20:33 ` Viktor Prutyanov
2020-09-11  4:18 ` Thomas Huth
2020-09-11  7:01   ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).