qemuDomainGetStatsBlock() could leak a stats hash table if it
encountered OOM while populating the virTypedParameters.
Oddly, the fix doesn't even touch qemuDomainGetStatsBlock :)
* src/qemu/qemu_driver.c (QEMU_ADD_COUNT_PARAM)
(QEMU_ADD_NAME_PARAM): Don't return early.
(qemuDomainGetStatsInterface): Adjust caller.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/qemu/qemu_driver.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9152cf5..a7b208f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18371,7 +18371,7 @@ do { \
maxparams, \
param_name, \
count) < 0) \
- return -1; \
+ goto cleanup; \
} while (0)
#define QEMU_ADD_NAME_PARAM(record, maxparams, type, num, name) \
@@ -18384,7 +18384,7 @@ do { \
maxparams, \
param_name, \
name) < 0) \
- return -1; \
+ goto cleanup; \
} while (0)
#define QEMU_ADD_NET_PARAM(record, maxparams, num, name, value) \
@@ -18448,6 +18448,7 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver
ATTRIBUTE_UNUSED,
"tx.drop", tmp.tx_drop);
}
+ cleanup:
return 0;
}
--
1.9.3