From: wliang@stu.xidian.edu.cn
To: "Cédric Le Goater" <clg@kaod.org>
Cc: "Philippe Mathieu-Daudé" <philippe.mathieu.daude@gmail.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: Fix a potential memory leak bug in write_boot_rom() (v6.2.0).
Date: Fri, 25 Feb 2022 11:30:55 +0800 (GMT+08:00) [thread overview]
Message-ID: <74d28271.93a.17f2eee79db.Coremail.wliang@stu.xidian.edu.cn> (raw)
In-Reply-To: <ae217469-9f0f-5f1e-f01b-4a6f525f1ff2@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 122 bytes --]
>
> yes. Could you please send a patch using g_autofree ?
>
> Thanks,
>
> C.
Here is the new patch.
Thanks,
Wentao
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-a-potential-memory-leak-bug-in-write_boot_rom-v6.patch --]
[-- Type: text/x-patch; name=0001-Fix-a-potential-memory-leak-bug-in-write_boot_rom-v6.patch, Size: 798 bytes --]
From 8ed76446f78ab1b4152403fdb9dd6f349d6fd52e Mon Sep 17 00:00:00 2001
From: Wentao_Liang <Wentao_Liang_g@163.com>
Date: Fri, 25 Feb 2022 11:17:33 +0800
Subject: [PATCH] Fix a potential memory leak bug in write_boot_rom() (v6.2.0).
Signed-off-by: Wentao_Liang <Wentao_Liang_g@163.com>
---
hw/arm/aspeed.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index d911dc904f..9da5f87429 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -276,6 +276,7 @@ static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size,
storage = g_new0(uint8_t, rom_size);
if (blk_pread(blk, 0, storage, rom_size) < 0) {
error_setg(errp, "failed to read the initial flash content");
+ g_free(storage);
return;
}
--
2.25.1
next prev parent reply other threads:[~2022-02-25 3:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 14:39 Fix a potential memory leak bug in write_boot_rom() (v6.2.0) wliang
2022-02-23 16:15 ` Philippe Mathieu-Daudé
2022-02-24 8:10 ` Cédric Le Goater
2022-02-25 3:30 ` wliang [this message]
2022-02-25 11:37 ` Peter Maydell
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=74d28271.93a.17f2eee79db.Coremail.wliang@stu.xidian.edu.cn \
--to=wliang@stu.xidian.edu.cn \
--cc=clg@kaod.org \
--cc=philippe.mathieu.daude@gmail.com \
--cc=qemu-devel@nongnu.org \
/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).