[NETCFGX] Free all component data on INetCfg_fnUninitialize()

This commit is contained in:
Eric Kohl
2019-10-20 10:04:08 +02:00
parent c1eccaffaa
commit 2ed4b3f780

View File

@@ -688,17 +688,64 @@ ApplyOrCancelChanges(
}
}
VOID
FreeComponentItem(NetCfgComponentItem *pItem)
{
CoTaskMemFree(pItem->szDisplayName);
CoTaskMemFree(pItem->szHelpText);
CoTaskMemFree(pItem->szId);
CoTaskMemFree(pItem->szBindName);
CoTaskMemFree(pItem->szNodeId);
CoTaskMemFree(pItem->pszBinding);
CoTaskMemFree(pItem);
}
HRESULT
WINAPI
INetCfg_fnUninitialize(
INetCfg * iface)
{
INetCfgImpl *This = (INetCfgImpl *)iface;
NetCfgComponentItem *pItem;
if (!This->bInitialized)
return NETCFG_E_NOT_INITIALIZED;
return E_FAIL;
/* Free the services */
while (This->pService != NULL)
{
pItem = This->pService;
This->pService = pItem->pNext;
FreeComponentItem(pItem);
}
/* Free the clients */
while (This->pClient != NULL)
{
pItem = This->pClient;
This->pClient = pItem->pNext;
FreeComponentItem(pItem);
}
/* Free the protocols */
while (This->pProtocol != NULL)
{
pItem = This->pProtocol;
This->pProtocol = pItem->pNext;
FreeComponentItem(pItem);
}
/* Free the adapters */
while (This->pNet != NULL)
{
pItem = This->pNet;
This->pNet = pItem->pNext;
FreeComponentItem(pItem);
}
This->bInitialized = FALSE;
return S_OK;
}