On Fri, Mar 29, 2019 at 02:53:55PM +0100, Peter Krempa wrote:
Unref the config pointer automatically in code paths which get a
local
copy.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 40 +++++++++++++---------------------------
1 file changed, 13 insertions(+), 27 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0318547bd8..150da34b4a 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1367,7 +1364,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
bool iface_connected = false;
virDomainNetType actualType;
virNetDevBandwidthPtr actualBandwidth;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
Nice, this fixes a memory leak on two 'return's below.
virDomainCCWAddressSetPtr ccwaddrs = NULL;
size_t i;
char *charDevAlias = NULL;
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano