From: Michal Privoznik Date: Wed, 27 Oct 2021 12:41:58 +0000 (+0200) Subject: qemuMonitorOpen: Rework domain object refcounting X-Git-Tag: v7.10.0-rc1~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3640731ed5c0bedf869ef4cb9bdecede40ec7d26;p=thirdparty%2Flibvirt.git qemuMonitorOpen: Rework domain object refcounting Similarly to one of previous commits, there's no need to increment domain object refcounter before unlocking it. Any number of lock and unlock calls over domain object has no effect on the refcounter. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 92dd4e7557..9ad8ffa422 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -769,10 +769,6 @@ qemuMonitorOpen(virDomainObj *vm, timeout += QEMU_DEFAULT_MONITOR_WAIT; - /* Hold an extra reference because we can't allow 'vm' to be - * deleted until the monitor gets its own reference. */ - virObjectRef(vm); - if (config->type != VIR_DOMAIN_CHR_TYPE_UNIX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unable to handle monitor type: %s"), @@ -798,7 +794,6 @@ qemuMonitorOpen(virDomainObj *vm, cleanup: if (!ret) VIR_FORCE_CLOSE(fd); - virObjectUnref(vm); return ret; }