char *datastoreName;
char *tmp;
char *saveptr;
- char *strippedFileName = NULL;
- char *copyOfFileName = NULL;
+ g_autofree char *strippedFileName = NULL;
+ g_autofree char *copyOfFileName = NULL;
char *directoryAndFileName;
int ret = -1;
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&datastoreList);
esxVI_DatastoreHostMount_Free(&hostMount);
- VIR_FREE(strippedFileName);
- VIR_FREE(copyOfFileName);
return ret;
}
bool success = false;
char *result = NULL;
esxVMX_Data *data = opaque;
- char *datastoreName = NULL;
- char *directoryAndFileName = NULL;
+ g_autofree char *datastoreName = NULL;
+ g_autofree char *directoryAndFileName = NULL;
esxVI_ObjectContent *datastore = NULL;
esxVI_DatastoreHostMount *hostMount = NULL;
char separator = '/';
if (! success)
VIR_FREE(result);
- VIR_FREE(datastoreName);
- VIR_FREE(directoryAndFileName);
esxVI_ObjectContent_Free(&datastore);
esxVI_DatastoreHostMount_Free(&hostMount);
{
int result = -1;
g_autofree char *ipAddress = NULL;
- char *username = NULL;
- char *password = NULL;
- char *url = NULL;
+ g_autofree char *username = NULL;
+ g_autofree char *password = NULL;
+ g_autofree char *url = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_Boolean inMaintenanceMode = esxVI_Boolean_Undefined;
result = 0;
cleanup:
- VIR_FREE(username);
- VIR_FREE(password);
- VIR_FREE(url);
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&hostSystem);
{
int result = -1;
g_autofree char *ipAddress = NULL;
- char *username = NULL;
- char *password = NULL;
- char *url = NULL;
+ g_autofree char *username = NULL;
+ g_autofree char *password = NULL;
+ g_autofree char *url = NULL;
if (!hostSystemIPAddress &&
(!priv->parsedUri->path || STREQ(priv->parsedUri->path, "/"))) {
result = 0;
cleanup:
- VIR_FREE(username);
- VIR_FREE(password);
- VIR_FREE(url);
-
return result;
}
{
virDrvOpenStatus result = VIR_DRV_OPEN_ERROR;
esxPrivate *priv = NULL;
- char *potentialVCenterIPAddress = NULL;
+ g_autofree char *potentialVCenterIPAddress = NULL;
g_autofree char *vCenterIPAddress = NULL;
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
cleanup:
esxFreePrivate(&priv);
- VIR_FREE(potentialVCenterIPAddress);
-
return result;
}
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_VirtualMachinePowerState powerState;
int id = -1;
- char *name = NULL;
+ g_autofree char *name = NULL;
virDomainPtr domain = NULL;
if (esxVI_EnsureSession(priv->primary) < 0)
cleanup:
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&virtualMachine);
- VIR_FREE(name);
-
return domain;
}
esxVI_VirtualMachinePowerState powerState;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_String_Free(&propertyNameList);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
esxVI_VirtualMachinePowerState powerState;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_String_Free(&propertyNameList);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
esxVI_VirtualMachinePowerState powerState;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virCheckFlags(0, -1);
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_String_Free(&propertyNameList);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
esxVI_VirtualMachineConfigSpec *spec = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_VirtualMachineConfigSpec_Free(&spec);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
esxVI_VirtualMachineConfigSpec *spec = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virCheckFlags(0, -1);
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_VirtualMachineConfigSpec_Free(&spec);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
esxVI_VirtualMachineConfigSpec *spec = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE, -1);
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_VirtualMachineConfigSpec_Free(&spec);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_VirtualMachinePowerState powerState;
int id;
- char *moref = NULL;
+ g_autofree char *moref = NULL;
char *vmPathName = NULL;
- char *datastoreName = NULL;
- char *directoryName = NULL;
- char *directoryAndFileName = NULL;
+ g_autofree char *datastoreName = NULL;
+ g_autofree char *directoryName = NULL;
+ g_autofree char *directoryAndFileName = NULL;
g_auto(virBuffer) buffer = VIR_BUFFER_INITIALIZER;
- char *url = NULL;
- char *vmx = NULL;
+ g_autofree char *url = NULL;
+ g_autofree char *vmx = NULL;
virVMXContext ctx;
esxVMX_Data data;
virDomainDefPtr def = NULL;
cleanup:
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&virtualMachine);
- VIR_FREE(moref);
- VIR_FREE(datastoreName);
- VIR_FREE(directoryName);
- VIR_FREE(directoryAndFileName);
- VIR_FREE(url);
VIR_FREE(data.datastorePathWithoutFileName);
- VIR_FREE(vmx);
virDomainDefFree(def);
return xml;
int id = -1;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virCheckFlags(0, -1);
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_String_Free(&propertyNameList);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
return result;
}
{
esxPrivate *priv = conn->privateData;
virDomainDefPtr def = NULL;
- char *vmx = NULL;
+ g_autofree char *vmx = NULL;
size_t i;
virDomainDiskDefPtr disk = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
int virtualHW_version;
virVMXContext ctx;
esxVMX_Data data;
- char *datastoreName = NULL;
- char *directoryName = NULL;
- char *escapedName = NULL;
+ g_autofree char *datastoreName = NULL;
+ g_autofree char *directoryName = NULL;
+ g_autofree char *escapedName = NULL;
g_auto(virBuffer) buffer = VIR_BUFFER_INITIALIZER;
- char *url = NULL;
+ g_autofree char *url = NULL;
char *datastoreRelatedPath = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_ManagedObjectReference *resourcePool = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virDomainPtr domain = NULL;
const char *src;
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
cleanup:
virDomainDefFree(def);
- VIR_FREE(vmx);
- VIR_FREE(datastoreName);
- VIR_FREE(directoryName);
- VIR_FREE(escapedName);
- VIR_FREE(url);
- VIR_FREE(datastoreRelatedPath);
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&hostSystem);
esxVI_ManagedObjectReference_Free(&resourcePool);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return domain;
}
esxVI_SharesInfo *sharesInfo = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
size_t i;
virCheckFlags(0, -1);
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_VirtualMachineConfigSpec_Free(&spec);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
esxVI_Event *eventList = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virCheckFlags(ESX_MIGRATION_FLAGS, -1);
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_Event_Free(&eventList);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virDomainSnapshotPtr snapshot = NULL;
bool diskOnly = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) != 0;
bool quiesce = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) != 0;
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return snapshot;
}
esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virCheckFlags(0, -1);
cleanup:
esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
esxVI_Boolean removeChildren = esxVI_Boolean_False;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN |
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY, -1);
cleanup:
esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
esxVI_VirtualMachineConfigSpec *spec = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
size_t i;
virCheckFlags(0, -1);
esxVI_ObjectContent_Free(&virtualMachine);
esxVI_VirtualMachineConfigSpec_Free(&spec);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
{
virStorageVolPtr volume = NULL;
esxPrivate *priv = pool->conn->privateData;
- char *datastorePath = NULL;
- char *key = NULL;
+ g_autofree char *datastorePath = NULL;
+ g_autofree char *key = NULL;
datastorePath = g_strdup_printf("[%s] %s", pool->name, name);
&esxStorageBackendVMFS, NULL);
cleanup:
- VIR_FREE(datastorePath);
- VIR_FREE(key);
-
return volume;
}
{
virStorageVolPtr volume = NULL;
esxPrivate *priv = conn->privateData;
- char *datastoreName = NULL;
- char *directoryAndFileName = NULL;
- char *key = NULL;
+ g_autofree char *datastoreName = NULL;
+ g_autofree char *directoryAndFileName = NULL;
+ g_autofree char *key = NULL;
if (esxUtil_ParseDatastorePath(path, &datastoreName, NULL,
&directoryAndFileName) < 0) {
&esxStorageBackendVMFS, NULL);
cleanup:
- VIR_FREE(datastoreName);
- VIR_FREE(directoryAndFileName);
- VIR_FREE(key);
-
return volume;
}
esxPrivate *priv = pool->conn->privateData;
virStoragePoolDef poolDef;
char *tmp;
- char *unescapedDatastorePath = NULL;
- char *unescapedDirectoryName = NULL;
- char *unescapedDirectoryAndFileName = NULL;
- char *directoryName = NULL;
- char *fileName = NULL;
- char *datastorePathWithoutFileName = NULL;
- char *datastorePath = NULL;
+ g_autofree char *unescapedDatastorePath = NULL;
+ g_autofree char *unescapedDirectoryName = NULL;
+ g_autofree char *unescapedDirectoryAndFileName = NULL;
+ g_autofree char *directoryName = NULL;
+ g_autofree char *fileName = NULL;
+ g_autofree char *datastorePathWithoutFileName = NULL;
+ g_autofree char *datastorePath = NULL;
esxVI_FileInfo *fileInfo = NULL;
esxVI_FileBackedVirtualDiskSpec *virtualDiskSpec = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
- char *uuid_string = NULL;
- char *key = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
+ g_autofree char *uuid_string = NULL;
+ g_autofree char *key = NULL;
g_autoptr(virStorageVolDef) def = NULL;
virCheckFlags(0, NULL);
virtualDiskSpec->adapterType = NULL;
}
- VIR_FREE(unescapedDatastorePath);
- VIR_FREE(unescapedDirectoryName);
- VIR_FREE(unescapedDirectoryAndFileName);
- VIR_FREE(directoryName);
- VIR_FREE(fileName);
- VIR_FREE(datastorePathWithoutFileName);
- VIR_FREE(datastorePath);
esxVI_FileInfo_Free(&fileInfo);
esxVI_FileBackedVirtualDiskSpec_Free(&virtualDiskSpec);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
- VIR_FREE(uuid_string);
- VIR_FREE(key);
-
return volume;
}
virStorageVolPtr volume = NULL;
esxPrivate *priv = pool->conn->privateData;
virStoragePoolDef poolDef;
- char *sourceDatastorePath = NULL;
+ g_autofree char *sourceDatastorePath = NULL;
char *tmp;
- char *unescapedDatastorePath = NULL;
- char *unescapedDirectoryName = NULL;
- char *unescapedDirectoryAndFileName = NULL;
- char *directoryName = NULL;
- char *fileName = NULL;
- char *datastorePathWithoutFileName = NULL;
- char *datastorePath = NULL;
+ g_autofree char *unescapedDatastorePath = NULL;
+ g_autofree char *unescapedDirectoryName = NULL;
+ g_autofree char *unescapedDirectoryAndFileName = NULL;
+ g_autofree char *directoryName = NULL;
+ g_autofree char *fileName = NULL;
+ g_autofree char *datastorePathWithoutFileName = NULL;
+ g_autofree char *datastorePath = NULL;
esxVI_FileInfo *fileInfo = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
- char *uuid_string = NULL;
- char *key = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
+ g_autofree char *uuid_string = NULL;
+ g_autofree char *key = NULL;
g_autoptr(virStorageVolDef) def = NULL;
virCheckFlags(0, NULL);
&esxStorageBackendVMFS, NULL);
cleanup:
- VIR_FREE(sourceDatastorePath);
- VIR_FREE(unescapedDatastorePath);
- VIR_FREE(unescapedDirectoryName);
- VIR_FREE(unescapedDirectoryAndFileName);
- VIR_FREE(directoryName);
- VIR_FREE(fileName);
- VIR_FREE(datastorePathWithoutFileName);
- VIR_FREE(datastorePath);
esxVI_FileInfo_Free(&fileInfo);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
- VIR_FREE(uuid_string);
- VIR_FREE(key);
-
return volume;
}
{
int result = -1;
esxPrivate *priv = volume->conn->privateData;
- char *datastorePath = NULL;
+ g_autofree char *datastorePath = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virCheckFlags(0, -1);
result = 0;
cleanup:
- VIR_FREE(datastorePath);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
{
int result = -1;
esxPrivate *priv = volume->conn->privateData;
- char *datastorePath = NULL;
+ g_autofree char *datastorePath = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
virCheckFlags(0, -1);
result = 0;
cleanup:
- VIR_FREE(datastorePath);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
-
return result;
}
{
int result = -1;
esxPrivate *priv = volume->conn->privateData;
- char *datastorePath = NULL;
+ g_autofree char *datastorePath = NULL;
esxVI_FileInfo *fileInfo = NULL;
esxVI_VmDiskFileInfo *vmDiskFileInfo = NULL;
result = 0;
cleanup:
- VIR_FREE(datastorePath);
esxVI_FileInfo_Free(&fileInfo);
return result;
{
esxPrivate *priv = volume->conn->privateData;
virStoragePoolDef pool;
- char *datastorePath = NULL;
+ g_autofree char *datastorePath = NULL;
esxVI_FileInfo *fileInfo = NULL;
esxVI_VmDiskFileInfo *vmDiskFileInfo = NULL;
esxVI_IsoImageFileInfo *isoImageFileInfo = NULL;
xml = virStorageVolDefFormat(&pool, &def);
cleanup:
- VIR_FREE(datastorePath);
esxVI_FileInfo_Free(&fileInfo);
VIR_FREE(def.key);
{
int result = -1;
esxStreamPrivate *streamPriv;
- char *range = NULL;
- char *userpwd = NULL;
+ g_autofree char *range = NULL;
+ g_autofree char *userpwd = NULL;
esxVI_MultiCURL *multi = NULL;
/* FIXME: Although there is already some code in place to deal with
esxFreeStreamPrivate(&streamPriv);
}
- VIR_FREE(range);
- VIR_FREE(userpwd);
-
return result;
}
char **directoryName, char **directoryAndFileName)
{
int result = -1;
- char *copyOfDatastorePath = NULL;
+ g_autofree char *copyOfDatastorePath = NULL;
char *tmp = NULL;
char *saveptr = NULL;
char *preliminaryDatastoreName = NULL;
VIR_FREE(*directoryAndFileName);
}
- VIR_FREE(copyOfDatastorePath);
-
return result;
}
char *
esxUtil_EscapeDatastoreItem(const char *string)
{
- char *replaced;
- char *escaped1;
+ g_autofree char *replaced = NULL;
+ g_autofree char *escaped1 = NULL;
char *escaped2 = NULL;
replaced = g_strdup(string);
escaped2 = esxUtil_EscapeBase64(escaped1);
cleanup:
- VIR_FREE(replaced);
- VIR_FREE(escaped1);
-
return escaped2;
}
esxVI_CURL_Debug(CURL *curl G_GNUC_UNUSED, curl_infotype type,
char *info, size_t size, void *userdata G_GNUC_UNUSED)
{
- char *buffer = NULL;
+ g_autofree char *buffer = NULL;
/*
* The libcurl documentation says:
break;
}
- VIR_FREE(buffer);
-
return 0;
}
#endif
const char *password, esxUtil_ParsedUri *parsedUri)
{
int result = -1;
- char *escapedPassword = NULL;
+ g_autofree char *escapedPassword = NULL;
if (!ctx || !url || !ipAddress || !username ||
!password || ctx->url || ctx->service || ctx->curl) {
result = 0;
cleanup:
- VIR_FREE(escapedPassword);
-
return result;
}
esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const char *path)
{
int result = -1;
- char *tmp = NULL;
+ g_autofree char *tmp = NULL;
char *saveptr = NULL;
char *previousItem = NULL;
char *item = NULL;
esxVI_ManagedObjectReference_Free(&root);
}
- VIR_FREE(tmp);
esxVI_Folder_Free(&folder);
return result;
int result = -1;
g_auto(virBuffer) buffer = VIR_BUFFER_INITIALIZER;
esxVI_Fault *fault = NULL;
- char *xpathExpression = NULL;
+ g_autofree char *xpathExpression = NULL;
xmlXPathContextPtr xpathContext = NULL;
xmlNodePtr responseNode = NULL;
esxVI_Fault_Free(&fault);
}
- VIR_FREE(xpathExpression);
xmlXPathFreeContext(xpathContext);
return result;
{
size_t i;
int result = -1;
- char *name = NULL;
+ g_autofree char *name = NULL;
if (!value) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
name, esxVI_Type_ToString(enumeration->type));
}
- VIR_FREE(name);
-
return result;
}
esxVI_ObjectContent *sessionManager = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
esxVI_UserSession *currentSession = NULL;
- char *escapedPassword = NULL;
+ g_autofree char *escapedPassword = NULL;
if (!ctx->sessionLock) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no mutex"));
cleanup:
virMutexUnlock(ctx->sessionLock);
- VIR_FREE(escapedPassword);
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&sessionManager);
esxVI_UserSession_Free(¤tSession);
esxVI_Occurrence occurrence)
{
int result = -1;
- char *datastoreName = NULL;
- char *directoryName = NULL;
- char *directoryAndFileName = NULL;
- char *fileName = NULL;
+ g_autofree char *datastoreName = NULL;
+ g_autofree char *directoryName = NULL;
+ g_autofree char *directoryAndFileName = NULL;
+ g_autofree char *fileName = NULL;
size_t length;
- char *datastorePathWithoutFileName = NULL;
+ g_autofree char *datastorePathWithoutFileName = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *datastore = NULL;
esxVI_ManagedObjectReference *hostDatastoreBrowser = NULL;
esxVI_FloppyImageFileQuery *floppyImageFileQuery = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
esxVI_TaskInfo *taskInfo = NULL;
esxVI_HostDatastoreBrowserSearchResults *searchResults = NULL;
if (searchSpec && searchSpec->matchPattern)
searchSpec->matchPattern->value = NULL;
- VIR_FREE(datastoreName);
- VIR_FREE(directoryName);
- VIR_FREE(directoryAndFileName);
- VIR_FREE(fileName);
- VIR_FREE(datastorePathWithoutFileName);
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&datastore);
esxVI_ManagedObjectReference_Free(&hostDatastoreBrowser);
esxVI_HostDatastoreBrowserSearchSpec_Free(&searchSpec);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
esxVI_TaskInfo_Free(&taskInfo);
esxVI_HostDatastoreBrowserSearchResults_Free(&searchResults);
esxVI_FolderFileQuery_Free(&folderFileQuery);
esxVI_VmDiskFileQuery *vmDiskFileQuery = NULL;
esxVI_IsoImageFileQuery *isoImageFileQuery = NULL;
esxVI_FloppyImageFileQuery *floppyImageFileQuery = NULL;
- char *datastorePath = NULL;
+ g_autofree char *datastorePath = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- char *taskInfoErrorMessage = NULL;
+ g_autofree char *taskInfoErrorMessage = NULL;
esxVI_TaskInfo *taskInfo = NULL;
ESX_VI_CHECK_ARG_LIST(searchResultsList);
esxVI_ObjectContent_Free(&datastore);
esxVI_ManagedObjectReference_Free(&hostDatastoreBrowser);
esxVI_HostDatastoreBrowserSearchSpec_Free(&searchSpec);
- VIR_FREE(datastorePath);
esxVI_ManagedObjectReference_Free(&task);
- VIR_FREE(taskInfoErrorMessage);
esxVI_TaskInfo_Free(&taskInfo);
esxVI_VmDiskFileQuery_Free(&vmDiskFileQuery);
esxVI_IsoImageFileQuery_Free(&isoImageFileQuery);
{
int result = -1;
esxVI_FileInfo *fileInfo = NULL;
- char *uuid_string = NULL;
+ g_autofree char *uuid_string = NULL;
ESX_VI_CHECK_ARG_LIST(key);
cleanup:
esxVI_FileInfo_Free(&fileInfo);
- VIR_FREE(uuid_string);
-
return result;
}
g_auto(virBuffer) buffer = VIR_BUFFER_INITIALIZER;
esxVI_ElementDescription *answerChoice = NULL;
int answerIndex = 0;
- char *possibleAnswers = NULL;
+ g_autofree char *possibleAnswers = NULL;
if (!blocked) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
result = 0;
cleanup:
- VIR_FREE(possibleAnswers);
-
return result;
}
int result = -1; \
const char *methodName = #_name; \
g_auto(virBuffer) buffer = VIR_BUFFER_INITIALIZER; \
- char *request = NULL; \
+ g_autofree char *request = NULL; \
esxVI_Response *response = NULL; \
\
ESX_VI__METHOD__PARAMETER__THIS__##_this_from_service \
result = 0; \
\
cleanup: \
- VIR_FREE(request); \
esxVI_Response_Free(&response); \
\
return result; \
esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type **number) \
{ \
int result = -1; \
- char *string; \
+ g_autofree char *string = NULL; \
long long value; \
\
if (!number || *number) { \
if (result < 0) { \
esxVI_##_type##_Free(number); \
} \
- \
- VIR_FREE(string); \
\
return result; \
}
esxVI_Type *actualType)
{
int result = -1;
- char *type = NULL;
+ g_autofree char *type = NULL;
if (!actualType || *actualType != esxVI_Type_Undefined) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
result = 0;
cleanup:
- VIR_FREE(type);
-
return result;
}