qemu-devel
[Top][All Lists]
Advanced

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

RE: [PATCH 08/22] qga: Plug unlikely memory leak in guest-set-memory-blo


From: Zhanghailiang
Subject: RE: [PATCH 08/22] qga: Plug unlikely memory leak in guest-set-memory-blocks
Date: Tue, 23 Jun 2020 08:35:08 +0000

Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>

> -----Original Message-----
> From: Markus Armbruster [mailto:armbru@redhat.com]
> Sent: Monday, June 22, 2020 6:43 PM
> To: qemu-devel@nongnu.org
> Cc: Michael Roth <mdroth@linux.vnet.ibm.com>; Zhanghailiang
> <zhang.zhanghailiang@huawei.com>
> Subject: [PATCH 08/22] qga: Plug unlikely memory leak in
> guest-set-memory-blocks
> 
> transfer_memory_block() leaks an Error object when reading file
> /sys/devices/system/memory/memory<INDEX>/state fails with errno other
> than ENOENT, and @sys2memblk is false, i.e. when the state file exists but
> cannot be read (seems quite unlikely), and this is guest-set-memory-blocks,
> not guest-get-memory-blocks.
> 
> Plug the leak.
> 
> Fixes: bd240fca42d5f072fb758a71720d9de9990ac553
> Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
> Cc: Hailiang Zhang <zhang.zhanghailiang@huawei.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  qga/commands-posix.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c index
> ae1348dc8f..cdbeb59dcc 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -2421,6 +2421,7 @@ static void
> transfer_memory_block(GuestMemoryBlock *mem_blk, bool sys2memblk,
>              if (sys2memblk) {
>                  error_propagate(errp, local_err);
>              } else {
> +                error_free(local_err);
>                  result->response =
> 
> GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_FAILED;
>              }
> --
> 2.26.2




reply via email to

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