From e5339e38ca29d3e1a788d19b2716ae6a49d00b2e Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Fri, 5 Feb 2021 00:46:24 -0500 Subject: [PATCH] esx: replace VIR_FREE with g_free in any ESX_VI__TEMPLATE__FREE Invocations of the macro ESX_VI__TEMPLATE__FREE() will free the main object (referenced as "item") that's pointing to all the things being VIR_FREEd in the body, so it is safe for all the pointers in item to just be g_freed rather that VIR_FREEd. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/esx/esx_vi.c | 18 +++++++++--------- src/esx/esx_vi_types.c | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 7e05318fdc..2eb8048858 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -805,19 +805,19 @@ ESX_VI__TEMPLATE__FREE(Context, virMutexDestroy(item->sessionLock); esxVI_CURL_Free(&item->curl); - VIR_FREE(item->url); - VIR_FREE(item->ipAddress); - VIR_FREE(item->username); - VIR_FREE(item->password); + g_free(item->url); + g_free(item->ipAddress); + g_free(item->username); + g_free(item->password); esxVI_ServiceContent_Free(&item->service); esxVI_UserSession_Free(&item->session); - VIR_FREE(item->sessionLock); + g_free(item->sessionLock); esxVI_Datacenter_Free(&item->datacenter); - VIR_FREE(item->datacenterPath); + g_free(item->datacenterPath); esxVI_ComputeResource_Free(&item->computeResource); - VIR_FREE(item->computeResourcePath); + g_free(item->computeResourcePath); esxVI_HostSystem_Free(&item->hostSystem); - VIR_FREE(item->hostSystemName); + g_free(item->hostSystemName); esxVI_SelectionSpec_Free(&item->selectSet_folderToChildEntity); esxVI_SelectionSpec_Free(&item->selectSet_hostSystemToParent); esxVI_SelectionSpec_Free(&item->selectSet_hostSystemToVm); @@ -1419,7 +1419,7 @@ ESX_VI__TEMPLATE__ALLOC(Response) /* esxVI_Response_Free */ ESX_VI__TEMPLATE__FREE(Response, { - VIR_FREE(item->content); + g_free(item->content); xmlFreeDoc(item->document); }) diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index 6821587e44..4d3617e0a8 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -900,8 +900,8 @@ ESX_VI__TEMPLATE__ALLOC(AnyType) ESX_VI__TEMPLATE__FREE(AnyType, { xmlFreeNode(item->node); - VIR_FREE(item->other); - VIR_FREE(item->value); + g_free(item->other); + g_free(item->value); }) const char * @@ -1117,7 +1117,7 @@ ESX_VI__TEMPLATE__FREE(String, { esxVI_String_Free(&item->_next); - VIR_FREE(item->value); + g_free(item->value); }) /* esxVI_String_Validate */ @@ -1421,7 +1421,7 @@ ESX_VI__TEMPLATE__ALLOC(DateTime) /* esxVI_DateTime_Free */ ESX_VI__TEMPLATE__FREE(DateTime, { - VIR_FREE(item->value); + g_free(item->value); }) /* esxVI_DateTime_Validate */ @@ -1564,8 +1564,8 @@ ESX_VI__TEMPLATE__ALLOC(Fault); /* esxVI_Fault_Free */ ESX_VI__TEMPLATE__FREE(Fault, { - VIR_FREE(item->faultcode); - VIR_FREE(item->faultstring); + g_free(item->faultcode); + g_free(item->faultstring); }) /* esxVI_Fault_Validate */ @@ -1595,7 +1595,7 @@ ESX_VI__TEMPLATE__ALLOC(MethodFault); /* esxVI_MethodFault_Free */ ESX_VI__TEMPLATE__FREE(MethodFault, { - VIR_FREE(item->_actualType); + g_free(item->_actualType); }) int @@ -1638,8 +1638,8 @@ ESX_VI__TEMPLATE__FREE(ManagedObjectReference, { esxVI_ManagedObjectReference_Free(&item->_next); - VIR_FREE(item->type); - VIR_FREE(item->value); + g_free(item->type); + g_free(item->value); }) /* esxVI_ManagedObjectReference_DeepCopy */ @@ -1732,17 +1732,17 @@ ESX_VI__TEMPLATE__ALLOC(Event) ESX_VI__TEMPLATE__FREE(Event, { esxVI_Event_Free(&item->_next); - VIR_FREE(item->_actualType); + g_free(item->_actualType); esxVI_Int_Free(&item->key); esxVI_Int_Free(&item->chainId); esxVI_DateTime_Free(&item->createdTime); - VIR_FREE(item->userName); + g_free(item->userName); /* FIXME: datacenter is currently ignored */ /* FIXME: computeResource is currently ignored */ /* FIXME: host is currently ignored */ esxVI_VmEventArgument_Free(&item->vm); - VIR_FREE(item->fullFormattedMessage); + g_free(item->fullFormattedMessage); }) /* esxVI_Event_Validate */