From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
Markus Armbruster <armbru@redhat.com>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH-for-5.2 v2] hw/rx/rx-gdbsim: Fix memory leak
Date: Fri, 30 Oct 2020 11:49:12 -0700 [thread overview]
Message-ID: <996efc40-c616-c73a-c65c-ea3ae13e1d5c@linaro.org> (raw)
In-Reply-To: <20201030134918.1518930-1-f4bug@amsat.org>
On 10/30/20 6:49 AM, Philippe Mathieu-Daudé wrote:
> As load_device_tree() returns allocated memory,
> we need to free it.
>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Fixes: bda19d7bb56 ("hw/rx: Add RX GDB simulator")
> Reported-by: Coverity (CID 1432307: RESOURCE_LEAK)
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> v2: NULL-initialize (Richard)
> ---
> hw/rx/rx-gdbsim.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
> index 417ec0564b3..d70865962e8 100644
> --- a/hw/rx/rx-gdbsim.c
> +++ b/hw/rx/rx-gdbsim.c
> @@ -122,7 +122,7 @@ static void rx_gdbsim_init(MachineState *machine)
> if (dtb_filename) {
> ram_addr_t dtb_offset;
> int dtb_size;
> - void *dtb;
> + g_autofree void *dtb = NULL;
>
> dtb = load_device_tree(dtb_filename, &dtb_size);
What I said was, merge the declaration and statement:
g_autofree void *dtb =
load_device_tree(...);
but whatever. You can still keep my previous conditional r-b.
r~
prev parent reply other threads:[~2020-10-30 18:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 13:49 [PATCH-for-5.2 v2] hw/rx/rx-gdbsim: Fix memory leak Philippe Mathieu-Daudé
2020-10-30 18:49 ` Richard Henderson [this message]
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=996efc40-c616-c73a-c65c-ea3ae13e1d5c@linaro.org \
--to=richard.henderson@linaro.org \
--cc=armbru@redhat.com \
--cc=f4bug@amsat.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=rth@twiddle.net \
--cc=ysato@users.sourceforge.jp \
/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).