From: Paolo Bonzini <pbonzini@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
qemu-devel@nongnu.org
Cc: Pan Nengyuan <pannengyuan@huawei.com>,
Li Qiang <liq3ea@gmail.com>,
Brijesh Singh <brijesh.singh@amd.com>
Subject: Re: [PATCH] target/i386: Fix memory leak in sev_read_file_base64()
Date: Mon, 20 Sep 2021 14:56:55 +0200 [thread overview]
Message-ID: <a5e4bf09-64f4-5fcd-bf30-d767c293b9eb@redhat.com> (raw)
In-Reply-To: <a25a7814-af34-eecd-2672-bda706692c31@redhat.com>
On 20/08/21 19:05, Philippe Mathieu-Daudé wrote:
> On 8/20/21 6:56 PM, Peter Maydell wrote:
>> In sev_read_file_base64() we call g_file_get_contents(), which
>> allocates memory for the file contents. We then base64-decode the
>> contents (which allocates another buffer for the decoded data), but
>> forgot to free the memory for the original file data.
>>
>> Use g_autofree to ensure that the file data is freed.
>>
>> Fixes: Coverity CID 1459997
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> Tested with 'make/make check' only...
>>
>> target/i386/sev.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
Queued, thanks.
Paolo
next prev parent reply other threads:[~2021-09-20 12:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-20 16:56 [PATCH] target/i386: Fix memory leak in sev_read_file_base64() Peter Maydell
2021-08-20 17:05 ` Philippe Mathieu-Daudé
2021-09-20 12:56 ` Paolo Bonzini [this message]
2021-09-13 12:33 ` 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=a5e4bf09-64f4-5fcd-bf30-d767c293b9eb@redhat.com \
--to=pbonzini@redhat.com \
--cc=brijesh.singh@amd.com \
--cc=liq3ea@gmail.com \
--cc=pannengyuan@huawei.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.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).