From: Markus Armbruster Date: Tue, 30 Jun 2020 09:03:33 +0000 (+0200) Subject: qga: Plug unlikely memory leak in guest-set-memory-blocks X-Git-Tag: qemu-xen-4.15.0~107^2~18 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b368123dd9979e8840b6c98ff69722e7bf1da54d;p=qemu-xen.git 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/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 Cc: Hailiang Zhang Signed-off-by: Markus Armbruster Reviewed-by: zhanghailiang Message-Id: <20200630090351.1247703-9-armbru@redhat.com> --- 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; }