mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-14 15:23:39 +00:00
Fixed memory leak in error case
This commit is contained in:
@@ -101,7 +101,11 @@ int info_GetLocalInterfaces(char* data, int maxdata)
|
|||||||
if (GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_GATEWAYS | GAA_FLAG_INCLUDE_PREFIX, NULL, pAdapterAddresses, &ulOutBufLen) != ERROR_SUCCESS)
|
if (GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_GATEWAYS | GAA_FLAG_INCLUDE_PREFIX, NULL, pAdapterAddresses, &ulOutBufLen) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
free(pAdapterAddresses);
|
free(pAdapterAddresses);
|
||||||
if (ulOutBufLen == 0) return 0;
|
if (ulOutBufLen == 0)
|
||||||
|
{
|
||||||
|
if (pAdapterInfo != NULL) free(pAdapterInfo);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
pAdapterAddresses = (IP_ADAPTER_ADDRESSES *)malloc(ulOutBufLen);
|
pAdapterAddresses = (IP_ADAPTER_ADDRESSES *)malloc(ulOutBufLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user