From: AlexChen <alex.chen@huawei.com>
To: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Cc: zhengchuan@huawei.com, qemu-devel@nongnu.org,
	zhang.zhanghailiang@huawei.com
Subject: elf2dmp: Fix memory leak on main() error paths
Date: Wed, 26 Aug 2020 18:15:53 +0800	[thread overview]
Message-ID: <5F463659.8080101@huawei.com> (raw)
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
next             reply	other threads:[~2020-08-26 10:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 10:15 AlexChen [this message]
2020-09-04  1:04 ` elf2dmp: Fix memory leak on main() error paths 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=5F463659.8080101@huawei.com \
    --to=alex.chen@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=viktor.prutyanov@phystech.edu \
    --cc=zhang.zhanghailiang@huawei.com \
    --cc=zhengchuan@huawei.com \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
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).