qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] target/i386: Fix memory leak in sev_read_file_base64()


From: Paolo Bonzini
Subject: Re: [PATCH] target/i386: Fix memory leak in sev_read_file_base64()
Date: Mon, 20 Sep 2021 14:56:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]