The function needs a pointer to the network to get list of DHCP leases. The pointer is obtained via virNetworkLookupByName() which requires callers to free the returned network once no longer needed. Otherwise it's leaked. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 77f51d9..555c140 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19652,7 +19652,7 @@ qemuGetDHCPInterfaces(virDomainPtr dom, int n_leases = 0; size_t i, j; size_t ifaces_count = 0; - virNetworkPtr network; + virNetworkPtr network = NULL; char macaddr[VIR_MAC_STRING_BUFLEN]; virDomainInterfacePtr iface = NULL; virNetworkDHCPLeasePtr *leases = NULL; @@ -19670,6 +19670,8 @@ qemuGetDHCPInterfaces(virDomainPtr dom, continue; virMacAddrFormat(&(vm->def->nets[i]->mac), macaddr); + if (network) + virNetworkFree(network); network = virNetworkLookupByName(dom->conn, vm->def->nets[i]->data.network.name); @@ -19720,6 +19722,8 @@ qemuGetDHCPInterfaces(virDomainPtr dom, rv = ifaces_count; cleanup: + if (network) + virNetworkFree(network); if (leases) { for (i = 0; i < n_leases; i++) virNetworkDHCPLeaseFree(leases[i]); -- 2.0.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list