qemu: fix a mem leak

fix a mem leak

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Chen Hanxiao 2018-03-17 18:24:09 +08:00 committed by Michal Privoznik
parent 70c67d4a15
commit 3ee5a4ddf7
1 changed files with 3 additions and 2 deletions

View File

@ -20667,15 +20667,15 @@ qemuARPGetInterfaces(virDomainObjPtr vm,
if (VIR_ALLOC(iface) < 0)
goto cleanup;
iface->naddrs = 1;
if (VIR_STRDUP(iface->name, vm->def->nets[i]->ifname) < 0)
goto cleanup;
if (VIR_STRDUP(iface->hwaddr, macaddr) < 0)
goto cleanup;
if (VIR_ALLOC_N(iface->addrs, iface->naddrs) < 0)
if (VIR_ALLOC(iface->addrs) < 0)
goto cleanup;
iface->naddrs = 1;
if (VIR_STRDUP(iface->addrs->addr, entry.ipaddr) < 0)
goto cleanup;
@ -20691,6 +20691,7 @@ qemuARPGetInterfaces(virDomainObjPtr vm,
cleanup:
virArpTableFree(table);
virDomainInterfaceFree(iface);
if (ifaces_ret) {
for (i = 0; i < ifaces_count; i++)