Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- Checked other pointer types that can be autounref as well, just found these instances. src/qemu/qemu_hotplug.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index e9285f0964..4cab132901 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1154,7 +1154,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, bool charDevPlugged = false; bool netdevPlugged = false; VIR_AUTOFREE(char *) netdev_name = NULL; - virConnectPtr conn = NULL; + VIR_AUTOUNREF(virConnectPtr) conn = NULL; virErrorPtr save_err = NULL; /* preallocate new slot for device */ @@ -1497,7 +1497,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, } VIR_FREE(vhostfd); VIR_FREE(vhostfdName); - virObjectUnref(conn); virDomainCCWAddressSetFree(ccwaddrs); VIR_FORCE_CLOSE(slirpfd); @@ -3475,7 +3474,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, bool needVlanUpdate = false; int ret = -1; int changeidx = -1; - virConnectPtr conn = NULL; + VIR_AUTOUNREF(virConnectPtr) conn = NULL; virErrorPtr save_err = NULL; if ((changeidx = virDomainNetFindIdx(vm->def, newdev)) < 0) @@ -3919,7 +3918,6 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, */ if (newdev && newdev->type == VIR_DOMAIN_NET_TYPE_NETWORK && conn) virDomainNetReleaseActualDevice(conn, vm->def, newdev); - virObjectUnref(conn); virErrorRestore(&save_err); return ret; @@ -4535,13 +4533,11 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver, if (net) { if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) { - virConnectPtr conn = virGetConnectNetwork(); - if (conn) { + VIR_AUTOUNREF(virConnectPtr) conn = virGetConnectNetwork(); + if (conn) virDomainNetReleaseActualDevice(conn, vm->def, net); - virObjectUnref(conn); - } else { + else VIR_WARN("Unable to release network device '%s'", NULLSTR(net->ifname)); - } } virDomainNetDefFree(net); } @@ -4641,13 +4637,11 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver, qemuDomainNetDeviceVportRemove(net); if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) { - virConnectPtr conn = virGetConnectNetwork(); - if (conn) { + VIR_AUTOUNREF(virConnectPtr) conn = virGetConnectNetwork(); + if (conn) virDomainNetReleaseActualDevice(conn, vm->def, net); - virObjectUnref(conn); - } else { + else VIR_WARN("Unable to release network device '%s'", NULLSTR(net->ifname)); - } } virDomainNetDefFree(net); return 0; -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list