Turn virCapabilities into a virObject

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@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-02-01 12:26:18 +00:00
parent 5b984370f6
commit fed92f08db
39 changed files with 83 additions and 75 deletions

View File

@ -40,6 +40,22 @@ VIR_ENUM_DECL(virCapsHostPMTarget)
VIR_ENUM_IMPL(virCapsHostPMTarget, VIR_NODE_SUSPEND_TARGET_LAST, VIR_ENUM_IMPL(virCapsHostPMTarget, VIR_NODE_SUSPEND_TARGET_LAST,
"suspend_mem", "suspend_disk", "suspend_hybrid"); "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: * virCapabilitiesNew:
* @hostarch: host machine architecture * @hostarch: host machine architecture
@ -55,7 +71,10 @@ virCapabilitiesNew(virArch hostarch,
{ {
virCapsPtr caps; virCapsPtr caps;
if (VIR_ALLOC(caps) < 0) if (virCapabilitiesInitialize() < 0)
return NULL;
if (!(caps = virObjectNew(virCapsClass)))
return NULL; return NULL;
caps->host.arch = hostarch; caps->host.arch = hostarch;
@ -165,17 +184,11 @@ virCapabilitiesFreeNUMAInfo(virCapsPtr caps)
caps->host.nnumaCell = 0; caps->host.nnumaCell = 0;
} }
/** static void
* virCapabilitiesFree: virCapabilitiesDispose(void *object)
* @caps: object to free {
* virCapsPtr caps = object;
* Free all memory associated with capabilities
*/
void
virCapabilitiesFree(virCapsPtr caps) {
int i; int i;
if (caps == NULL)
return;
for (i = 0 ; i < caps->nguests ; i++) for (i = 0 ; i < caps->nguests ; i++)
virCapabilitiesFreeGuest(caps->guests[i]); virCapabilitiesFreeGuest(caps->guests[i]);
@ -198,8 +211,6 @@ virCapabilitiesFree(virCapsPtr caps) {
VIR_FREE(caps->host.secModels); VIR_FREE(caps->host.secModels);
virCPUDefFree(caps->host.cpu); virCPUDefFree(caps->host.cpu);
VIR_FREE(caps);
} }

View File

@ -29,6 +29,7 @@
# include "cpu_conf.h" # include "cpu_conf.h"
# include "virarch.h" # include "virarch.h"
# include "virmacaddr.h" # include "virmacaddr.h"
# include "virobject.h"
# include <libxml/xpath.h> # include <libxml/xpath.h>
@ -152,6 +153,8 @@ struct _virDomainXMLNamespace {
typedef struct _virCaps virCaps; typedef struct _virCaps virCaps;
typedef virCaps* virCapsPtr; typedef virCaps* virCapsPtr;
struct _virCaps { struct _virCaps {
virObject parent;
virCapsHost host; virCapsHost host;
size_t nguests; size_t nguests;
size_t nguests_max; size_t nguests_max;
@ -177,9 +180,6 @@ virCapabilitiesNew(virArch hostarch,
int offlineMigrate, int offlineMigrate,
int liveMigrate); int liveMigrate);
extern void
virCapabilitiesFree(virCapsPtr caps);
extern void extern void
virCapabilitiesFreeNUMAInfo(virCapsPtr caps); virCapabilitiesFreeNUMAInfo(virCapsPtr caps);

View File

@ -70,7 +70,7 @@ esxFreePrivate(esxPrivate **priv)
esxVI_Context_Free(&(*priv)->host); esxVI_Context_Free(&(*priv)->host);
esxVI_Context_Free(&(*priv)->vCenter); esxVI_Context_Free(&(*priv)->vCenter);
esxUtil_FreeParsedUri(&(*priv)->parsedUri); esxUtil_FreeParsedUri(&(*priv)->parsedUri);
virCapabilitiesFree((*priv)->caps); virObjectUnref((*priv)->caps);
VIR_FREE(*priv); VIR_FREE(*priv);
} }
@ -642,7 +642,7 @@ esxCapsInit(esxPrivate *priv)
return caps; return caps;
failure: failure:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }

View File

@ -62,7 +62,6 @@ virCapabilitiesDefaultGuestArch;
virCapabilitiesDefaultGuestEmulator; virCapabilitiesDefaultGuestEmulator;
virCapabilitiesDefaultGuestMachine; virCapabilitiesDefaultGuestMachine;
virCapabilitiesFormatXML; virCapabilitiesFormatXML;
virCapabilitiesFree;
virCapabilitiesFreeMachines; virCapabilitiesFreeMachines;
virCapabilitiesFreeNUMAInfo; virCapabilitiesFreeNUMAInfo;
virCapabilitiesGenerateMac; virCapabilitiesGenerateMac;

View File

@ -169,7 +169,7 @@ libxlBuildCapabilities(virArch hostarch,
return caps; return caps;
no_memory: no_memory:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
@ -297,7 +297,7 @@ libxlMakeCapabilitiesInternal(virArch hostarch,
no_memory: no_memory:
virReportOOMError(); virReportOOMError();
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }

View File

@ -1074,7 +1074,7 @@ libxlShutdown(void)
return -1; return -1;
libxlDriverLock(libxl_driver); libxlDriverLock(libxl_driver);
virCapabilitiesFree(libxl_driver->caps); virObjectUnref(libxl_driver->caps);
virObjectUnref(libxl_driver->domains); virObjectUnref(libxl_driver->domains);
libxl_ctx_free(libxl_driver->ctx); libxl_ctx_free(libxl_driver->ctx);
xtl_logger_destroy(libxl_driver->logger); xtl_logger_destroy(libxl_driver->logger);

View File

@ -150,7 +150,7 @@ no_memory:
virReportOOMError(); virReportOOMError();
error: error:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }

View File

@ -182,7 +182,7 @@ static virLXCControllerPtr virLXCControllerNew(const char *name)
cleanup: cleanup:
VIR_FREE(configFile); VIR_FREE(configFile);
virCapabilitiesFree(caps); virObjectUnref(caps);
return ctrl; return ctrl;
no_memory: no_memory:

View File

@ -1559,7 +1559,7 @@ static int lxcShutdown(void)
virLXCProcessAutoDestroyShutdown(lxc_driver); virLXCProcessAutoDestroyShutdown(lxc_driver);
virCapabilitiesFree(lxc_driver->caps); virObjectUnref(lxc_driver->caps);
virSecurityManagerFree(lxc_driver->securityManager); virSecurityManagerFree(lxc_driver->securityManager);
VIR_FREE(lxc_driver->configDir); VIR_FREE(lxc_driver->configDir);
VIR_FREE(lxc_driver->autostartDir); VIR_FREE(lxc_driver->autostartDir);

View File

@ -210,7 +210,7 @@ virCapsPtr openvzCapsInit(void)
return caps; return caps;
no_memory: no_memory:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
@ -559,7 +559,7 @@ openvzFreeDriver(struct openvz_driver *driver)
return; return;
virObjectUnref(driver->domains); virObjectUnref(driver->domains);
virCapabilitiesFree(driver->caps); virObjectUnref(driver->caps);
VIR_FREE(driver); VIR_FREE(driver);
} }

View File

@ -157,7 +157,7 @@ parallelsBuildCapabilities(void)
no_memory: no_memory:
virReportOOMError(); virReportOOMError();
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
@ -941,7 +941,7 @@ parallelsOpenDefault(virConnectPtr conn)
error: error:
virObjectUnref(privconn->domains); virObjectUnref(privconn->domains);
virCapabilitiesFree(privconn->caps); virObjectUnref(privconn->caps);
virStoragePoolObjListFree(&privconn->pools); virStoragePoolObjListFree(&privconn->pools);
VIR_FREE(privconn); VIR_FREE(privconn);
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
@ -986,7 +986,7 @@ parallelsClose(virConnectPtr conn)
parallelsConnPtr privconn = conn->privateData; parallelsConnPtr privconn = conn->privateData;
parallelsDriverLock(privconn); parallelsDriverLock(privconn);
virCapabilitiesFree(privconn->caps); virObjectUnref(privconn->caps);
virObjectUnref(privconn->domains); virObjectUnref(privconn->domains);
conn->privateData = NULL; conn->privateData = NULL;

View File

@ -346,7 +346,7 @@ phypCapsInit(void)
return caps; return caps;
no_memory: no_memory:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
@ -1222,7 +1222,7 @@ phypOpen(virConnectPtr conn,
failure: failure:
if (phyp_driver != NULL) { if (phyp_driver != NULL) {
virCapabilitiesFree(phyp_driver->caps); virObjectUnref(phyp_driver->caps);
VIR_FREE(phyp_driver->managed_system); VIR_FREE(phyp_driver->managed_system);
VIR_FREE(phyp_driver); VIR_FREE(phyp_driver);
} }
@ -1251,7 +1251,7 @@ phypClose(virConnectPtr conn)
libssh2_session_disconnect(session, "Disconnecting..."); libssh2_session_disconnect(session, "Disconnecting...");
libssh2_session_free(session); libssh2_session_free(session);
virCapabilitiesFree(phyp_driver->caps); virObjectUnref(phyp_driver->caps);
phypUUIDTable_Free(phyp_driver->uuid_table); phypUUIDTable_Free(phyp_driver->uuid_table);
VIR_FREE(phyp_driver->managed_system); VIR_FREE(phyp_driver->managed_system);
VIR_FREE(phyp_driver); VIR_FREE(phyp_driver);

View File

@ -932,7 +932,7 @@ virCapsPtr qemuCapsInit(qemuCapsCachePtr cache)
return caps; return caps;
error: error:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }

View File

@ -483,7 +483,7 @@ no_memory:
virReportOOMError(); virReportOOMError();
err_exit: err_exit:
VIR_FREE(sec_managers); VIR_FREE(sec_managers);
virCapabilitiesFree(caps); virObjectUnref(caps);
virObjectUnref(cfg); virObjectUnref(cfg);
return NULL; return NULL;
} }
@ -1054,7 +1054,7 @@ qemuShutdown(void) {
virObjectUnref(qemu_driver->inactivePciHostdevs); virObjectUnref(qemu_driver->inactivePciHostdevs);
virObjectUnref(qemu_driver->activeUsbHostdevs); virObjectUnref(qemu_driver->activeUsbHostdevs);
virHashFree(qemu_driver->sharedDisks); virHashFree(qemu_driver->sharedDisks);
virCapabilitiesFree(qemu_driver->caps); virObjectUnref(qemu_driver->caps);
qemuCapsCacheFree(qemu_driver->capsCache); qemuCapsCacheFree(qemu_driver->capsCache);
virObjectUnref(qemu_driver->domains); virObjectUnref(qemu_driver->domains);
@ -1281,12 +1281,10 @@ static char *qemuGetCapabilities(virConnectPtr conn) {
qemuDriverLock(driver); qemuDriverLock(driver);
if ((caps = qemuCreateCapabilities(qemu_driver)) == NULL) { if ((caps = qemuCreateCapabilities(qemu_driver)) == NULL)
virCapabilitiesFree(caps);
goto cleanup; goto cleanup;
}
virCapabilitiesFree(qemu_driver->caps); virObjectUnref(qemu_driver->caps);
qemu_driver->caps = caps; qemu_driver->caps = caps;
if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL) if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL)

View File

@ -84,7 +84,7 @@ vahDeinit(vahControl * ctl)
return -1; return -1;
VIR_FREE(ctl->def); VIR_FREE(ctl->def);
virCapabilitiesFree(ctl->caps); virObjectUnref(ctl->caps);
VIR_FREE(ctl->files); VIR_FREE(ctl->files);
VIR_FREE(ctl->hvm); VIR_FREE(ctl->hvm);
VIR_FREE(ctl->newfile); VIR_FREE(ctl->newfile);

View File

@ -230,7 +230,7 @@ testBuildCapabilities(virConnectPtr conn) {
no_memory: no_memory:
virReportOOMError(); virReportOOMError();
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
@ -651,7 +651,7 @@ error:
virInterfaceObjListFree(&privconn->ifaces); virInterfaceObjListFree(&privconn->ifaces);
virStoragePoolObjListFree(&privconn->pools); virStoragePoolObjListFree(&privconn->pools);
virNodeDeviceObjListFree(&privconn->devs); virNodeDeviceObjListFree(&privconn->devs);
virCapabilitiesFree(privconn->caps); virObjectUnref(privconn->caps);
testDriverUnlock(privconn); testDriverUnlock(privconn);
conn->privateData = NULL; conn->privateData = NULL;
VIR_FREE(privconn); VIR_FREE(privconn);
@ -1183,7 +1183,7 @@ static int testClose(virConnectPtr conn)
{ {
testConnPtr privconn = conn->privateData; testConnPtr privconn = conn->privateData;
testDriverLock(privconn); testDriverLock(privconn);
virCapabilitiesFree(privconn->caps); virObjectUnref(privconn->caps);
virObjectUnref(privconn->domains); virObjectUnref(privconn->domains);
virNodeDeviceObjListFree(&privconn->devs); virNodeDeviceObjListFree(&privconn->devs);
virNetworkObjListFree(&privconn->networks); virNetworkObjListFree(&privconn->networks);

View File

@ -107,7 +107,7 @@ virCapsPtr umlCapsInit(void) {
return caps; return caps;
error: error:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }

View File

@ -631,7 +631,7 @@ umlShutdown(void) {
if (uml_driver->inotifyWatch != -1) if (uml_driver->inotifyWatch != -1)
virEventRemoveHandle(uml_driver->inotifyWatch); virEventRemoveHandle(uml_driver->inotifyWatch);
VIR_FORCE_CLOSE(uml_driver->inotifyFD); VIR_FORCE_CLOSE(uml_driver->inotifyFD);
virCapabilitiesFree(uml_driver->caps); virObjectUnref(uml_driver->caps);
/* shutdown active VMs /* shutdown active VMs
* XXX allow them to stay around & reconnect */ * XXX allow them to stay around & reconnect */

View File

@ -886,7 +886,7 @@ static virCapsPtr vboxCapsInit(void)
return caps; return caps;
no_memory: no_memory:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
@ -977,7 +977,7 @@ static void vboxUninitialize(vboxGlobalData *data) {
if (data->pFuncs) if (data->pFuncs)
data->pFuncs->pfnComUninitialize(); data->pFuncs->pfnComUninitialize();
virCapabilitiesFree(data->caps); virObjectUnref(data->caps);
#if VBOX_API_VERSION == 2002 #if VBOX_API_VERSION == 2002
/* No domainEventCallbacks in 2.2.* version */ /* No domainEventCallbacks in 2.2.* version */
#else /* !(VBOX_API_VERSION == 2002) */ #else /* !(VBOX_API_VERSION == 2002) */

View File

@ -44,7 +44,7 @@ vmwareFreeDriver(struct vmware_driver *driver)
virMutexDestroy(&driver->lock); virMutexDestroy(&driver->lock);
virObjectUnref(driver->domains); virObjectUnref(driver->domains);
virCapabilitiesFree(driver->caps); virObjectUnref(driver->caps);
VIR_FREE(driver); VIR_FREE(driver);
} }
@ -133,7 +133,7 @@ cleanup:
return caps; return caps;
error: error:
virCapabilitiesFree(caps); virObjectUnref(caps);
goto cleanup; goto cleanup;
} }

View File

@ -447,7 +447,7 @@ xenUnifiedClose(virConnectPtr conn)
GET_PRIVATE(conn); GET_PRIVATE(conn);
int i; int i;
virCapabilitiesFree(priv->caps); virObjectUnref(priv->caps);
virDomainEventStateFree(priv->domainEvents); virDomainEventStateFree(priv->domainEvents);
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)

View File

@ -2343,7 +2343,7 @@ xenHypervisorBuildCapabilities(virConnectPtr conn,
if (hv_versions.sys_interface >= SYS_IFACE_MIN_VERS_NUMA && conn != NULL) { if (hv_versions.sys_interface >= SYS_IFACE_MIN_VERS_NUMA && conn != NULL) {
if (xenDaemonNodeGetTopology(conn, caps) != 0) { if (xenDaemonNodeGetTopology(conn, caps) != 0) {
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
} }
@ -2444,7 +2444,7 @@ xenHypervisorBuildCapabilities(virConnectPtr conn,
return caps; return caps;
no_memory: no_memory:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
@ -2708,7 +2708,7 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
no_memory: no_memory:
virReportOOMError(); virReportOOMError();
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }

View File

@ -88,7 +88,7 @@ getCapsObject(void)
return caps; return caps;
error_cleanup: error_cleanup:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
@ -207,7 +207,7 @@ xenapiOpen(virConnectPtr conn, virConnectAuthPtr auth,
VIR_FREE(password); VIR_FREE(password);
if (privP != NULL) { if (privP != NULL) {
virCapabilitiesFree(privP->caps); virObjectUnref(privP->caps);
if (privP->session != NULL) if (privP->session != NULL)
xenSessionFree(privP->session); xenSessionFree(privP->session);
@ -230,7 +230,7 @@ xenapiClose(virConnectPtr conn)
{ {
struct _xenapiPrivate *priv = conn->privateData; struct _xenapiPrivate *priv = conn->privateData;
virCapabilitiesFree(priv->caps); virObjectUnref(priv->caps);
if (priv->session != NULL) { if (priv->session != NULL) {
xen_session_logout(priv->session); xen_session_logout(priv->session);

View File

@ -112,7 +112,7 @@ mymain(void)
DO_TEST("metadata", "c7a5fdbd-edaf-9455-926a-d65c16db1809", 0); DO_TEST("metadata", "c7a5fdbd-edaf-9455-926a-d65c16db1809", 0);
DO_TEST("external_vm", "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; return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
} }

View File

@ -123,7 +123,7 @@ mymain(void)
DO_TEST("systemd"); DO_TEST("systemd");
DO_TEST("hostdev"); DO_TEST("hostdev");
virCapabilitiesFree(caps); virObjectUnref(caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE; return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
} }

View File

@ -243,7 +243,7 @@ mymain(void)
DO_TEST_FULL("qemu-ns-no-env", 1, NULL); DO_TEST_FULL("qemu-ns-no-env", 1, NULL);
virObjectUnref(driver.config); virObjectUnref(driver.config);
virCapabilitiesFree(driver.caps); virObjectUnref(driver.caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE; return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
} }

View File

@ -462,7 +462,7 @@ mymain(void)
DO_TEST(GetCPUDefinitions); DO_TEST(GetCPUDefinitions);
DO_TEST(GetCommands); DO_TEST(GetCommands);
virCapabilitiesFree(caps); virObjectUnref(caps);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE; return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
} }

View File

@ -883,7 +883,7 @@ mymain(void)
QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL_VGA); QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL_VGA);
virObjectUnref(driver.config); virObjectUnref(driver.config);
virCapabilitiesFree(driver.caps); virObjectUnref(driver.caps);
VIR_FREE(map); VIR_FREE(map);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE; return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;

View File

@ -258,7 +258,7 @@ mymain(void)
DO_TEST_DIFFERENT("metadata"); DO_TEST_DIFFERENT("metadata");
virCapabilitiesFree(driver.caps); virObjectUnref(driver.caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE; return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
} }

View File

@ -251,7 +251,7 @@ mymain(void)
DO_TEST("qemu-ns-commandline-ns1", false, NONE); DO_TEST("qemu-ns-commandline-ns1", false, NONE);
virObjectUnref(driver.config); virObjectUnref(driver.config);
virCapabilitiesFree(driver.caps); virObjectUnref(driver.caps);
VIR_FREE(map); VIR_FREE(map);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE; return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;

View File

@ -183,7 +183,7 @@ mymain(void)
DO_TEST("boot-grub", "boot-grub", 1); DO_TEST("boot-grub", "boot-grub", 1);
virCapabilitiesFree(caps); virObjectUnref(caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE; return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
} }

View File

@ -58,7 +58,7 @@ virCapsPtr testLXCCapsInit(void) {
return caps; return caps;
error: error:
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
#endif #endif

View File

@ -261,7 +261,7 @@ virCapsPtr testQemuCapsInit(void) {
cleanup: cleanup:
virCapabilitiesFreeMachines(machines, nmachines); virCapabilitiesFreeMachines(machines, nmachines);
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
#endif #endif

View File

@ -75,6 +75,6 @@ virCapsPtr testXenCapsInit(void) {
cleanup: cleanup:
virCapabilitiesFreeMachines(machines, nmachines); virCapabilitiesFreeMachines(machines, nmachines);
virCapabilitiesFree(caps); virObjectUnref(caps);
return NULL; return NULL;
} }

View File

@ -71,7 +71,7 @@ testCapsInit(void)
return; return;
failure: failure:
virCapabilitiesFree(caps); virObjectUnref(caps);
caps = NULL; caps = NULL;
} }
@ -295,7 +295,7 @@ mymain(void)
DO_TEST("svga", "svga"); DO_TEST("svga", "svga");
virCapabilitiesFree(caps); virObjectUnref(caps);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
} }

View File

@ -62,7 +62,7 @@ testCompareFiles(virArch hostmachine, const char *xml_rel,
VIR_FORCE_FCLOSE(fp1); VIR_FORCE_FCLOSE(fp1);
VIR_FORCE_FCLOSE(fp2); VIR_FORCE_FCLOSE(fp2);
virCapabilitiesFree(caps); virObjectUnref(caps);
return ret; return ret;
} }

View File

@ -245,7 +245,7 @@ mymain(void)
DO_TEST("no-source-cdrom", 2); DO_TEST("no-source-cdrom", 2);
DO_TEST("pci-devs", 2); DO_TEST("pci-devs", 2);
virCapabilitiesFree(caps); virObjectUnref(caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE; return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
} }

View File

@ -168,7 +168,7 @@ mymain(void)
DO_TEST("boot-grub", "boot-grub", "fvtest", 1); DO_TEST("boot-grub", "boot-grub", "fvtest", 1);
DO_TEST("escape", "escape", "fvtest", 1); DO_TEST("escape", "escape", "fvtest", 1);
virCapabilitiesFree(caps); virObjectUnref(caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE; return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
} }

View File

@ -71,7 +71,7 @@ testCapsInit(void)
return; return;
failure: failure:
virCapabilitiesFree(caps); virObjectUnref(caps);
caps = NULL; caps = NULL;
} }
@ -305,7 +305,7 @@ mymain(void)
DO_TEST("svga", "svga", 4); DO_TEST("svga", "svga", 4);
virCapabilitiesFree(caps); virObjectUnref(caps);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
} }