[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 08/25] qga: Plug unlikely memory leak in guest-set-memory-bloc
From: |
Markus Armbruster |
Subject: |
[PATCH v2 08/25] qga: Plug unlikely memory leak in guest-set-memory-blocks |
Date: |
Wed, 24 Jun 2020 10:37:20 +0200 |
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>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.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
- [PATCH v2 05/25] tests: Use error_free_or_abort() where appropriate, (continued)
- [PATCH v2 05/25] tests: Use error_free_or_abort() where appropriate, Markus Armbruster, 2020/06/24
- [PATCH v2 14/25] qdev: Drop qbus_set_hotplug_handler() parameter @errp, Markus Armbruster, 2020/06/24
- [PATCH v2 03/25] Clean up some calls to ignore Error objects the right way, Markus Armbruster, 2020/06/24
- [PATCH v2 04/25] tests: Use &error_abort where appropriate, Markus Armbruster, 2020/06/24
- [PATCH v2 13/25] qdev: Drop qbus_set_bus_hotplug_handler() parameter @errp, Markus Armbruster, 2020/06/24
- [PATCH v2 12/25] aspeed: Clean up roundabout error propagation, Markus Armbruster, 2020/06/24
- [PATCH v2 09/25] sd/milkymist-memcard: Plug minor memory leak in realize, Markus Armbruster, 2020/06/24
- [PATCH v2 08/25] qga: Plug unlikely memory leak in guest-set-memory-blocks,
Markus Armbruster <=
- [PATCH v2 20/25] x86: Fix x86_cpu_new() error API violations, Markus Armbruster, 2020/06/24
- [PATCH v2 06/25] usb/dev-mtp: Fix Error double free after inotify failure, Markus Armbruster, 2020/06/24
- [PATCH v2 17/25] riscv/sifive_u: Fix sifive_u_soc_realize() error API violations, Markus Armbruster, 2020/06/24
- [PATCH v2 19/25] mips/cps: Fix mips_cps_realize() error API violations, Markus Armbruster, 2020/06/24
- [PATCH v2 02/25] pci: Delete useless error_propagate(), Markus Armbruster, 2020/06/24