From: "Daniel P. Berrange" <berrange(a)redhat.com>
To enable virCapabilities instances to be reference counted,
turn it into a virObject. All cases of virCapabilitiesFree
turn into virObjectUnref
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/conf/capabilities.c | 29 +++++++++++++++++++++++------
src/conf/capabilities.h | 6 +++---
src/esx/esx_driver.c | 4 ++--
src/libvirt_private.syms | 1 -
src/libxl/libxl_conf.c | 4 ++--
src/libxl/libxl_driver.c | 2 +-
src/lxc/lxc_conf.c | 2 +-
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_driver.c | 2 +-
src/openvz/openvz_conf.c | 4 ++--
src/parallels/parallels_driver.c | 6 +++---
src/phyp/phyp_driver.c | 6 +++---
src/qemu/qemu_capabilities.c | 2 +-
src/qemu/qemu_conf.h | 2 +-
src/qemu/qemu_driver.c | 10 ++++------
src/security/virt-aa-helper.c | 2 +-
src/test/test_driver.c | 6 +++---
src/uml/uml_conf.c | 2 +-
src/uml/uml_driver.c | 2 +-
src/vbox/vbox_tmpl.c | 4 ++--
src/vmware/vmware_conf.c | 4 ++--
src/xen/xen_driver.c | 2 +-
src/xen/xen_hypervisor.c | 6 +++---
src/xenapi/xenapi_driver.c | 6 +++---
tests/domainsnapshotxml2xmltest.c | 2 +-
tests/lxcxml2xmltest.c | 2 +-
tests/qemuargv2xmltest.c | 2 +-
tests/qemumonitorjsontest.c | 2 +-
tests/qemuxml2argvtest.c | 2 +-
tests/qemuxml2xmltest.c | 2 +-
tests/qemuxmlnstest.c | 2 +-
tests/sexpr2xmltest.c | 2 +-
tests/testutilslxc.c | 2 +-
tests/testutilsqemu.c | 2 +-
tests/testutilsxen.c | 2 +-
tests/vmx2xmltest.c | 4 ++--
tests/xencapstest.c | 2 +-
tests/xmconfigtest.c | 2 +-
tests/xml2sexprtest.c | 2 +-
tests/xml2vmxtest.c | 4 ++--
40 files changed, 83 insertions(+), 69 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 4897b9a..820364b 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -40,6 +40,22 @@ VIR_ENUM_DECL(virCapsHostPMTarget)
VIR_ENUM_IMPL(virCapsHostPMTarget, VIR_NODE_SUSPEND_TARGET_LAST,
"suspend_mem", "suspend_disk",
"suspend_hybrid");
+static virClassPtr virCapsClass;
+static void virCapabilitiesDispose(void *obj);
+
+static int virCapabilitiesOnceInit(void)
+{
+ if (!(virCapsClass = virClassNew(virClassForObject(),
+ "virCaps",
+ sizeof(virCaps),
+ virCapabilitiesDispose)))
+ return -1;
+
+ return 0;
+}
+
+VIR_ONCE_GLOBAL_INIT(virCapabilities)
+
/**
* virCapabilitiesNew:
* @hostarch: host machine architecture
@@ -55,7 +71,10 @@ virCapabilitiesNew(virArch hostarch,
{
virCapsPtr caps;
- if (VIR_ALLOC(caps) < 0)
+ if (virCapabilitiesInitialize() < 0)
+ return NULL;
+
+ if (!(caps = virObjectNew(virCapsClass)))
return NULL;
caps->host.arch = hostarch;
@@ -172,10 +191,10 @@ virCapabilitiesFreeNUMAInfo(virCapsPtr caps)
* Free all memory associated with capabilities
*/
void
-virCapabilitiesFree(virCapsPtr caps) {
+virCapabilitiesDispose(void *object)
+{
+ virCapsPtr caps = object;
int i;
- if (caps == NULL)
- return;
for (i = 0 ; i < caps->nguests ; i++)
virCapabilitiesFreeGuest(caps->guests[i]);
@@ -198,8 +217,6 @@ virCapabilitiesFree(virCapsPtr caps) {
VIR_FREE(caps->host.secModels);
virCPUDefFree(caps->host.cpu);
-
- VIR_FREE(caps);
}
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index f5a5c48..cc01765 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -29,6 +29,7 @@
# include "cpu_conf.h"
# include "virarch.h"
# include "virmacaddr.h"
+# include "virobject.h"
# include <libxml/xpath.h>
@@ -152,6 +153,8 @@ struct _virDomainXMLNamespace {
typedef struct _virCaps virCaps;
typedef virCaps* virCapsPtr;
struct _virCaps {
+ virObject parent;
+
virCapsHost host;
size_t nguests;
size_t nguests_max;
@@ -178,9 +181,6 @@ virCapabilitiesNew(virArch hostarch,
int liveMigrate);
extern void
-virCapabilitiesFree(virCapsPtr caps);
-
-extern void
virCapabilitiesFreeNUMAInfo(virCapsPtr caps);
extern void
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 77f463c..046035d 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -70,7 +70,7 @@ esxFreePrivate(esxPrivate **priv)
esxVI_Context_Free(&(*priv)->host);
esxVI_Context_Free(&(*priv)->vCenter);
esxUtil_FreeParsedUri(&(*priv)->parsedUri);
- virCapabilitiesFree((*priv)->caps);
+ virObjectUnref((*priv)->caps);
VIR_FREE(*priv);
}
@@ -642,7 +642,7 @@ esxCapsInit(esxPrivate *priv)
return caps;
failure:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 57e3eb4..99e6d09 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -62,7 +62,6 @@ virCapabilitiesDefaultGuestArch;
virCapabilitiesDefaultGuestEmulator;
virCapabilitiesDefaultGuestMachine;
virCapabilitiesFormatXML;
-virCapabilitiesFree;
virCapabilitiesFreeMachines;
virCapabilitiesFreeNUMAInfo;
virCapabilitiesGenerateMac;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 9245a24..43fb8b1 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -169,7 +169,7 @@ libxlBuildCapabilities(virArch hostarch,
return caps;
no_memory:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
@@ -297,7 +297,7 @@ libxlMakeCapabilitiesInternal(virArch hostarch,
no_memory:
virReportOOMError();
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index d11acfc..22bd245 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1074,7 +1074,7 @@ libxlShutdown(void)
return -1;
libxlDriverLock(libxl_driver);
- virCapabilitiesFree(libxl_driver->caps);
+ virObjectUnref(libxl_driver->caps);
virObjectUnref(libxl_driver->domains);
libxl_ctx_free(libxl_driver->ctx);
xtl_logger_destroy(libxl_driver->logger);
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index 90f5680..7b808e7 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -150,7 +150,7 @@ no_memory:
virReportOOMError();
error:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 2673f72..aa70481 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -182,7 +182,7 @@ static virLXCControllerPtr virLXCControllerNew(const char *name)
cleanup:
VIR_FREE(configFile);
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return ctrl;
no_memory:
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 671b19d..f07ce14 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1559,7 +1559,7 @@ static int lxcShutdown(void)
virLXCProcessAutoDestroyShutdown(lxc_driver);
- virCapabilitiesFree(lxc_driver->caps);
+ virObjectUnref(lxc_driver->caps);
virSecurityManagerFree(lxc_driver->securityManager);
VIR_FREE(lxc_driver->configDir);
VIR_FREE(lxc_driver->autostartDir);
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 3081417..fde32ce 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -210,7 +210,7 @@ virCapsPtr openvzCapsInit(void)
return caps;
no_memory:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
@@ -559,7 +559,7 @@ openvzFreeDriver(struct openvz_driver *driver)
return;
virObjectUnref(driver->domains);
- virCapabilitiesFree(driver->caps);
+ virObjectUnref(driver->caps);
VIR_FREE(driver);
}
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 4e1889f..8f8fdac 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -157,7 +157,7 @@ parallelsBuildCapabilities(void)
no_memory:
virReportOOMError();
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
@@ -941,7 +941,7 @@ parallelsOpenDefault(virConnectPtr conn)
error:
virObjectUnref(privconn->domains);
- virCapabilitiesFree(privconn->caps);
+ virObjectUnref(privconn->caps);
virStoragePoolObjListFree(&privconn->pools);
VIR_FREE(privconn);
return VIR_DRV_OPEN_ERROR;
@@ -986,7 +986,7 @@ parallelsClose(virConnectPtr conn)
parallelsConnPtr privconn = conn->privateData;
parallelsDriverLock(privconn);
- virCapabilitiesFree(privconn->caps);
+ virObjectUnref(privconn->caps);
virObjectUnref(privconn->domains);
conn->privateData = NULL;
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 74f04ff..8c67338 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -346,7 +346,7 @@ phypCapsInit(void)
return caps;
no_memory:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
@@ -1222,7 +1222,7 @@ phypOpen(virConnectPtr conn,
failure:
if (phyp_driver != NULL) {
- virCapabilitiesFree(phyp_driver->caps);
+ virObjectUnref(phyp_driver->caps);
VIR_FREE(phyp_driver->managed_system);
VIR_FREE(phyp_driver);
}
@@ -1251,7 +1251,7 @@ phypClose(virConnectPtr conn)
libssh2_session_disconnect(session, "Disconnecting...");
libssh2_session_free(session);
- virCapabilitiesFree(phyp_driver->caps);
+ virObjectUnref(phyp_driver->caps);
phypUUIDTable_Free(phyp_driver->uuid_table);
VIR_FREE(phyp_driver->managed_system);
VIR_FREE(phyp_driver);
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e390cb1..ceed735 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -932,7 +932,7 @@ virCapsPtr qemuCapsInit(qemuCapsCachePtr cache)
return caps;
error:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 60c4109..8fada4e 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -164,7 +164,7 @@ struct _virQEMUDriver {
/* Atomic increment only */
int nextvmid;
- /* Immutable pointer. Unsafe APIs XXX */
+ /* Immutable pointer. Immutable object */
virCgroupPtr cgroup;
/* Atomic inc/dec only */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 979a027..d1d1ccf 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -483,7 +483,7 @@ no_memory:
virReportOOMError();
err_exit:
VIR_FREE(sec_managers);
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
virObjectUnref(cfg);
return NULL;
}
@@ -1054,7 +1054,7 @@ qemuShutdown(void) {
virObjectUnref(qemu_driver->inactivePciHostdevs);
virObjectUnref(qemu_driver->activeUsbHostdevs);
virHashFree(qemu_driver->sharedDisks);
- virCapabilitiesFree(qemu_driver->caps);
+ virObjectUnref(qemu_driver->caps);
qemuCapsCacheFree(qemu_driver->capsCache);
virObjectUnref(qemu_driver->domains);
@@ -1281,12 +1281,10 @@ static char *qemuGetCapabilities(virConnectPtr conn) {
qemuDriverLock(driver);
- if ((caps = qemuCreateCapabilities(qemu_driver)) == NULL) {
- virCapabilitiesFree(caps);
+ if ((caps = qemuCreateCapabilities(qemu_driver)) == NULL)
goto cleanup;
- }
- virCapabilitiesFree(qemu_driver->caps);
+ virObjectUnref(qemu_driver->caps);
qemu_driver->caps = caps;
if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 7b12a7d..8ce1f53 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -84,7 +84,7 @@ vahDeinit(vahControl * ctl)
return -1;
VIR_FREE(ctl->def);
- virCapabilitiesFree(ctl->caps);
+ virObjectUnref(ctl->caps);
VIR_FREE(ctl->files);
VIR_FREE(ctl->hvm);
VIR_FREE(ctl->newfile);
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 1b31e00..30ce8e7 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -230,7 +230,7 @@ testBuildCapabilities(virConnectPtr conn) {
no_memory:
virReportOOMError();
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
@@ -651,7 +651,7 @@ error:
virInterfaceObjListFree(&privconn->ifaces);
virStoragePoolObjListFree(&privconn->pools);
virNodeDeviceObjListFree(&privconn->devs);
- virCapabilitiesFree(privconn->caps);
+ virObjectUnref(privconn->caps);
testDriverUnlock(privconn);
conn->privateData = NULL;
VIR_FREE(privconn);
@@ -1183,7 +1183,7 @@ static int testClose(virConnectPtr conn)
{
testConnPtr privconn = conn->privateData;
testDriverLock(privconn);
- virCapabilitiesFree(privconn->caps);
+ virObjectUnref(privconn->caps);
virObjectUnref(privconn->domains);
virNodeDeviceObjListFree(&privconn->devs);
virNetworkObjListFree(&privconn->networks);
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 31a4490..b3ac326 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -107,7 +107,7 @@ virCapsPtr umlCapsInit(void) {
return caps;
error:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 3f245b6..63a807a 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -631,7 +631,7 @@ umlShutdown(void) {
if (uml_driver->inotifyWatch != -1)
virEventRemoveHandle(uml_driver->inotifyWatch);
VIR_FORCE_CLOSE(uml_driver->inotifyFD);
- virCapabilitiesFree(uml_driver->caps);
+ virObjectUnref(uml_driver->caps);
/* shutdown active VMs
* XXX allow them to stay around & reconnect */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 0a164dc..00b4d3d 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -886,7 +886,7 @@ static virCapsPtr vboxCapsInit(void)
return caps;
no_memory:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
@@ -977,7 +977,7 @@ static void vboxUninitialize(vboxGlobalData *data) {
if (data->pFuncs)
data->pFuncs->pfnComUninitialize();
- virCapabilitiesFree(data->caps);
+ virObjectUnref(data->caps);
#if VBOX_API_VERSION == 2002
/* No domainEventCallbacks in 2.2.* version */
#else /* !(VBOX_API_VERSION == 2002) */
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 1afd372..a17b2e1 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -44,7 +44,7 @@ vmwareFreeDriver(struct vmware_driver *driver)
virMutexDestroy(&driver->lock);
virObjectUnref(driver->domains);
- virCapabilitiesFree(driver->caps);
+ virObjectUnref(driver->caps);
VIR_FREE(driver);
}
@@ -133,7 +133,7 @@ cleanup:
return caps;
error:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
goto cleanup;
}
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index cf2e0cc..d896893 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -447,7 +447,7 @@ xenUnifiedClose(virConnectPtr conn)
GET_PRIVATE(conn);
int i;
- virCapabilitiesFree(priv->caps);
+ virObjectUnref(priv->caps);
virDomainEventStateFree(priv->domainEvents);
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index bfee56d..68475b6 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2343,7 +2343,7 @@ xenHypervisorBuildCapabilities(virConnectPtr conn,
if (hv_versions.sys_interface >= SYS_IFACE_MIN_VERS_NUMA && conn != NULL)
{
if (xenDaemonNodeGetTopology(conn, caps) != 0) {
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
}
@@ -2444,7 +2444,7 @@ xenHypervisorBuildCapabilities(virConnectPtr conn,
return caps;
no_memory:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
@@ -2708,7 +2708,7 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
no_memory:
virReportOOMError();
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index b812aeb..df7ab36 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -88,7 +88,7 @@ getCapsObject(void)
return caps;
error_cleanup:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
@@ -207,7 +207,7 @@ xenapiOpen(virConnectPtr conn, virConnectAuthPtr auth,
VIR_FREE(password);
if (privP != NULL) {
- virCapabilitiesFree(privP->caps);
+ virObjectUnref(privP->caps);
if (privP->session != NULL)
xenSessionFree(privP->session);
@@ -230,7 +230,7 @@ xenapiClose(virConnectPtr conn)
{
struct _xenapiPrivate *priv = conn->privateData;
- virCapabilitiesFree(priv->caps);
+ virObjectUnref(priv->caps);
if (priv->session != NULL) {
xen_session_logout(priv->session);
diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c
index 42897a0..aeea997 100644
--- a/tests/domainsnapshotxml2xmltest.c
+++ b/tests/domainsnapshotxml2xmltest.c
@@ -112,7 +112,7 @@ mymain(void)
DO_TEST("metadata", "c7a5fdbd-edaf-9455-926a-d65c16db1809", 0);
DO_TEST("external_vm", "c7a5fdbd-edaf-9455-926a-d65c16db1809",
0);
- virCapabilitiesFree(driver.caps);
+ virObjectUnref(driver.caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index 8694ca2..bfb6092 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -123,7 +123,7 @@ mymain(void)
DO_TEST("systemd");
DO_TEST("hostdev");
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index 8062a02..3c23010 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -243,7 +243,7 @@ mymain(void)
DO_TEST_FULL("qemu-ns-no-env", 1, NULL);
virObjectUnref(driver.config);
- virCapabilitiesFree(driver.caps);
+ virObjectUnref(driver.caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 35f2da6..ef6cd6e 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -447,7 +447,7 @@ mymain(void)
DO_TEST(GetCPUDefinitions);
DO_TEST(GetCommands);
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 4e90b26..c0c720e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -872,7 +872,7 @@ mymain(void)
QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL_VGA);
virObjectUnref(driver.config);
- virCapabilitiesFree(driver.caps);
+ virObjectUnref(driver.caps);
VIR_FREE(map);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 160e958..3f36896 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -258,7 +258,7 @@ mymain(void)
DO_TEST_DIFFERENT("metadata");
- virCapabilitiesFree(driver.caps);
+ virObjectUnref(driver.caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 38b5e88..de80a0f 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -251,7 +251,7 @@ mymain(void)
DO_TEST("qemu-ns-commandline-ns1", false, NONE);
virObjectUnref(driver.config);
- virCapabilitiesFree(driver.caps);
+ virObjectUnref(driver.caps);
VIR_FREE(map);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
index 07f6f8e..b7487ef 100644
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -183,7 +183,7 @@ mymain(void)
DO_TEST("boot-grub", "boot-grub", 1);
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/testutilslxc.c b/tests/testutilslxc.c
index b0a2580..0c2170c 100644
--- a/tests/testutilslxc.c
+++ b/tests/testutilslxc.c
@@ -58,7 +58,7 @@ virCapsPtr testLXCCapsInit(void) {
return caps;
error:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
#endif
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 573927d..966527c 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -261,7 +261,7 @@ virCapsPtr testQemuCapsInit(void) {
cleanup:
virCapabilitiesFreeMachines(machines, nmachines);
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
#endif
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index 094c75e..6d97925 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -75,6 +75,6 @@ virCapsPtr testXenCapsInit(void) {
cleanup:
virCapabilitiesFreeMachines(machines, nmachines);
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return NULL;
}
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index 2430350..cee4c39 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -71,7 +71,7 @@ testCapsInit(void)
return;
failure:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
caps = NULL;
}
@@ -295,7 +295,7 @@ mymain(void)
DO_TEST("svga", "svga");
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/xencapstest.c b/tests/xencapstest.c
index b8ad831..381802e 100644
--- a/tests/xencapstest.c
+++ b/tests/xencapstest.c
@@ -62,7 +62,7 @@ testCompareFiles(virArch hostmachine, const char *xml_rel,
VIR_FORCE_FCLOSE(fp1);
VIR_FORCE_FCLOSE(fp2);
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return ret;
}
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index a3943e2..9f71aa2 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -245,7 +245,7 @@ mymain(void)
DO_TEST("no-source-cdrom", 2);
DO_TEST("pci-devs", 2);
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index 0a17c81..a41568a 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -168,7 +168,7 @@ mymain(void)
DO_TEST("boot-grub", "boot-grub", "fvtest", 1);
DO_TEST("escape", "escape", "fvtest", 1);
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index c578109..c46c5a4 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -71,7 +71,7 @@ testCapsInit(void)
return;
failure:
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
caps = NULL;
}
@@ -305,7 +305,7 @@ mymain(void)
DO_TEST("svga", "svga", 4);
- virCapabilitiesFree(caps);
+ virObjectUnref(caps);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
1.8.1