提交 3ee5a4dd 编写于 作者: C Chen Hanxiao 提交者: Michal Privoznik

qemu: fix a mem leak

fix a mem leak
Signed-off-by: NChen Hanxiao <chenhanxiao@gmail.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 70c67d4a
...@@ -20667,15 +20667,15 @@ qemuARPGetInterfaces(virDomainObjPtr vm, ...@@ -20667,15 +20667,15 @@ qemuARPGetInterfaces(virDomainObjPtr vm,
if (VIR_ALLOC(iface) < 0) if (VIR_ALLOC(iface) < 0)
goto cleanup; goto cleanup;
iface->naddrs = 1;
if (VIR_STRDUP(iface->name, vm->def->nets[i]->ifname) < 0) if (VIR_STRDUP(iface->name, vm->def->nets[i]->ifname) < 0)
goto cleanup; goto cleanup;
if (VIR_STRDUP(iface->hwaddr, macaddr) < 0) if (VIR_STRDUP(iface->hwaddr, macaddr) < 0)
goto cleanup; goto cleanup;
if (VIR_ALLOC_N(iface->addrs, iface->naddrs) < 0) if (VIR_ALLOC(iface->addrs) < 0)
goto cleanup; goto cleanup;
iface->naddrs = 1;
if (VIR_STRDUP(iface->addrs->addr, entry.ipaddr) < 0) if (VIR_STRDUP(iface->addrs->addr, entry.ipaddr) < 0)
goto cleanup; goto cleanup;
...@@ -20691,6 +20691,7 @@ qemuARPGetInterfaces(virDomainObjPtr vm, ...@@ -20691,6 +20691,7 @@ qemuARPGetInterfaces(virDomainObjPtr vm,
cleanup: cleanup:
virArpTableFree(table); virArpTableFree(table);
virDomainInterfaceFree(iface);
if (ifaces_ret) { if (ifaces_ret) {
for (i = 0; i < ifaces_count; i++) for (i = 0; i < ifaces_count; i++)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册