Skip to content

Commit

Permalink
esx: switch VIR_FREE->g_free when the pointer will immediately go out…
Browse files Browse the repository at this point in the history
… of scope

Or when it will be immediately have a new value assigned to it.

Signed-off-by: Laine Stump <[email protected]>
Reviewed-by: Michal Privoznik <[email protected]>
  • Loading branch information
Laine Stump committed Feb 16, 2021
1 parent 0a69fa6 commit d6e357c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/esx/esx_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2619,7 +2619,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
cleanup:
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&virtualMachine);
VIR_FREE(data.datastorePathWithoutFileName);
g_free(data.datastorePathWithoutFileName);
virDomainDefFree(def);

return xml;
Expand Down Expand Up @@ -4946,7 +4946,7 @@ esxConnectListAllDomains(virConnectPtr conn,
for (id = 0; id < count; id++)
virObjectUnref(doms[id]);

VIR_FREE(doms);
g_free(doms);
}

esxVI_AutoStartDefaults_Free(&autoStartDefaults);
Expand Down
2 changes: 1 addition & 1 deletion src/esx/esx_network_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ esxConnectListAllNetworks(virConnectPtr conn,
if (ret < 0) {
if (nets && *nets) {
for (i = 0; i < count; ++i)
VIR_FREE((*nets)[i]);
g_free((*nets)[i]);
VIR_FREE(*nets);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/esx/esx_storage_backend_iscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
xml = virStoragePoolDefFormat(&def);

cleanup:
VIR_FREE(def.source.hosts);
g_free(def.source.hosts);
esxVI_HostInternetScsiHba_Free(&hostInternetScsiHba);

return xml;
Expand Down Expand Up @@ -727,7 +727,7 @@ esxStorageVolGetXMLDesc(virStorageVolPtr volume,

cleanup:
esxVI_ScsiLun_Free(&scsiLunList);
VIR_FREE(def.key);
g_free(def.key);

return xml;
}
Expand Down
4 changes: 2 additions & 2 deletions src/esx/esx_storage_backend_vmfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
xml = virStoragePoolDefFormat(&def);

cleanup:
VIR_FREE(def.source.hosts);
g_free(def.source.hosts);
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&datastore);
esxVI_DatastoreHostMount_Free(&hostMount);
Expand Down Expand Up @@ -1390,7 +1390,7 @@ esxStorageVolGetXMLDesc(virStorageVolPtr volume,

cleanup:
esxVI_FileInfo_Free(&fileInfo);
VIR_FREE(def.key);
g_free(def.key);

return xml;
}
Expand Down
4 changes: 2 additions & 2 deletions src/esx/esx_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
virURIParamPtr queryParam = &uri->params[i];

if (STRCASEEQ(queryParam->name, "transport")) {
VIR_FREE((*parsedUri)->transport);
g_free((*parsedUri)->transport);

(*parsedUri)->transport = g_strdup(queryParam->value);

Expand All @@ -68,7 +68,7 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
goto cleanup;
}
} else if (STRCASEEQ(queryParam->name, "vcenter")) {
VIR_FREE((*parsedUri)->vCenter);
g_free((*parsedUri)->vCenter);

(*parsedUri)->vCenter = g_strdup(queryParam->value);
} else if (STRCASEEQ(queryParam->name, "no_verify")) {
Expand Down
4 changes: 2 additions & 2 deletions src/esx/esx_vi.c
Original file line number Diff line number Diff line change
Expand Up @@ -4280,7 +4280,7 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
if (esxVI_WaitForUpdates(ctx, version, &updateSet) < 0)
goto cleanup;

VIR_FREE(version);
g_free(version);
version = g_strdup(updateSet->version);

if (!updateSet->filterSet)
Expand Down Expand Up @@ -4355,7 +4355,7 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx,

esxVI_PropertyFilterSpec_Free(&propertyFilterSpec);
esxVI_ManagedObjectReference_Free(&propertyFilter);
VIR_FREE(version);
g_free(version);
esxVI_UpdateSet_Free(&updateSet);
esxVI_TaskInfo_Free(&taskInfo);

Expand Down

0 comments on commit d6e357c

Please sign in to comment.