Replace virDomainChrSourceDefFree with virObjectUnref. Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx> Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx> --- cfg.mk | 1 - src/conf/domain_conf.c | 17 +++++------------ src/conf/domain_conf.h | 1 - src/libvirt_private.syms | 1 - src/qemu/qemu_domain.c | 4 ++-- src/qemu/qemu_parse_command.c | 4 ++-- src/qemu/qemu_process.c | 5 ++--- 7 files changed, 11 insertions(+), 22 deletions(-) diff --git a/cfg.mk b/cfg.mk index c2524de5fc6b..7762422da764 100644 --- a/cfg.mk +++ b/cfg.mk @@ -120,7 +120,6 @@ useless_free_options = \ --name=virConfFreeValue \ --name=virDomainActualNetDefFree \ --name=virDomainChrDefFree \ - --name=virDomainChrSourceDefFree \ --name=virDomainControllerDefFree \ --name=virDomainDefFree \ --name=virDomainDeviceDefFree \ diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 56c437ca0a34..5b61656d89b9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2194,7 +2194,7 @@ virDomainNetDefClear(virDomainNetDefPtr def) switch (def->type) { case VIR_DOMAIN_NET_TYPE_VHOSTUSER: - virDomainChrSourceDefFree(def->data.vhostuser); + virObjectUnref(def->data.vhostuser); def->data.vhostuser = NULL; break; @@ -2433,13 +2433,6 @@ virDomainChrSourceDefDispose(void *obj) } -void -virDomainChrSourceDefFree(virDomainChrSourceDefPtr def) -{ - virObjectUnref(def); -} - - /* virDomainChrSourceDefIsEqual: * @src: Source * @tgt: Target @@ -2530,7 +2523,7 @@ void virDomainChrDefFree(virDomainChrDefPtr def) break; } - virDomainChrSourceDefFree(def->source); + virObjectUnref(def->source); virDomainDeviceInfoClear(&def->info); VIR_FREE(def); @@ -2553,7 +2546,7 @@ void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def) break; case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: - virDomainChrSourceDefFree(def->data.passthru); + virObjectUnref(def->data.passthru); break; default: @@ -2812,7 +2805,7 @@ void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def) if (!def) return; - virDomainChrSourceDefFree(def->source); + virObjectUnref(def->source); virDomainDeviceInfoClear(&def->info); VIR_FREE(def); @@ -26562,7 +26555,7 @@ virDomainRNGDefFree(virDomainRNGDefPtr def) VIR_FREE(def->source.file); break; case VIR_DOMAIN_RNG_BACKEND_EGD: - virDomainChrSourceDefFree(def->source.chardev); + virObjectUnref(def->source.chardev); break; case VIR_DOMAIN_RNG_BACKEND_LAST: break; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9bccd8bcd15c..f205fc872328 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2911,7 +2911,6 @@ void virDomainNetDefClear(virDomainNetDefPtr def); void virDomainNetDefFree(virDomainNetDefPtr def); void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def); void virDomainChrDefFree(virDomainChrDefPtr def); -void virDomainChrSourceDefFree(virDomainChrSourceDefPtr def); int virDomainChrSourceDefCopy(virDomainChrSourceDefPtr dest, virDomainChrSourceDefPtr src); void virDomainSoundCodecDefFree(virDomainSoundCodecDefPtr def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b720acdc939d..e5c9ccdbe497 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -221,7 +221,6 @@ virDomainChrSerialTargetTypeFromString; virDomainChrSerialTargetTypeToString; virDomainChrSourceDefClear; virDomainChrSourceDefCopy; -virDomainChrSourceDefFree; virDomainChrSourceDefGetPath; virDomainChrSourceDefNew; virDomainChrSpicevmcTypeFromString; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bbd4a5efe8d8..9996098494d7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2063,7 +2063,7 @@ qemuDomainObjPrivateFree(void *data) qemuDomainObjPrivateDataClear(priv); - virDomainChrSourceDefFree(priv->monConfig); + virObjectUnref(priv->monConfig); qemuDomainObjFreeJob(priv); VIR_FREE(priv->lockState); VIR_FREE(priv->origname); @@ -3084,7 +3084,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, VIR_FREE(tmp); virBitmapFree(priv->namespaces); priv->namespaces = NULL; - virDomainChrSourceDefFree(priv->monConfig); + virObjectUnref(priv->monConfig); priv->monConfig = NULL; virStringListFree(priv->qemuDevices); priv->qemuDevices = NULL; diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 81691cb85ee1..49b34b1c178e 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -2495,7 +2495,7 @@ qemuParseCommandLine(virFileCachePtr capsCache, goto error; if (qemuParseCommandLineChr(chr, val) < 0) { - virDomainChrSourceDefFree(chr); + virObjectUnref(chr); goto error; } @@ -2732,7 +2732,7 @@ qemuParseCommandLine(virFileCachePtr capsCache, virStringListFree(list); VIR_FREE(nics); if (monConfig) { - virDomainChrSourceDefFree(*monConfig); + virObjectUnref(*monConfig); *monConfig = NULL; } if (pidfile) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index f06fe62f9931..68c670d3f2e5 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1887,8 +1887,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob, virObjectRef(vm); ignore_value(virTimeMillisNow(&priv->monStart)); - monConfig = priv->monConfig; - virObjectRef(monConfig); + monConfig = virObjectRef(priv->monConfig); virObjectUnlock(vm); mon = qemuMonitorOpen(vm, @@ -7184,7 +7183,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, if (priv->monConfig) { if (priv->monConfig->type == VIR_DOMAIN_CHR_TYPE_UNIX) unlink(priv->monConfig->data.nix.path); - virDomainChrSourceDefFree(priv->monConfig); + virObjectUnref(priv->monConfig); priv->monConfig = NULL; } -- 2.17.0