mirror of
https://github.com/a0rtega/pafish
synced 2024-11-21 22:01:56 +03:00
re #49 fixes LocalFree after advanced list
This commit is contained in:
parent
d13b9cb1d0
commit
8f84f98034
@ -153,6 +153,7 @@ int pafish_check_mac_vendor(char * mac_vendor) {
|
|||||||
ret = GetAdaptersAddresses(AF_UNSPEC,0,0,0,&alist_size);
|
ret = GetAdaptersAddresses(AF_UNSPEC,0,0,0,&alist_size);
|
||||||
if(ret==ERROR_BUFFER_OVERFLOW) {
|
if(ret==ERROR_BUFFER_OVERFLOW) {
|
||||||
IP_ADAPTER_ADDRESSES* palist = (IP_ADAPTER_ADDRESSES*)LocalAlloc(LMEM_ZEROINIT,alist_size);
|
IP_ADAPTER_ADDRESSES* palist = (IP_ADAPTER_ADDRESSES*)LocalAlloc(LMEM_ZEROINIT,alist_size);
|
||||||
|
void * palist_free = palist;
|
||||||
if(palist) {
|
if(palist) {
|
||||||
GetAdaptersAddresses(AF_UNSPEC,0,0,palist,&alist_size);
|
GetAdaptersAddresses(AF_UNSPEC,0,0,palist,&alist_size);
|
||||||
char mac[6]={0};
|
char mac[6]={0};
|
||||||
@ -160,13 +161,13 @@ int pafish_check_mac_vendor(char * mac_vendor) {
|
|||||||
if (palist->PhysicalAddressLength==0x6){
|
if (palist->PhysicalAddressLength==0x6){
|
||||||
memcpy(mac,palist->PhysicalAddress,0x6);
|
memcpy(mac,palist->PhysicalAddress,0x6);
|
||||||
if (!memcmp(mac_vendor, mac, 3)) { /* First 3 bytes are the same */
|
if (!memcmp(mac_vendor, mac, 3)) { /* First 3 bytes are the same */
|
||||||
LocalFree(palist);
|
LocalFree(palist_free);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
palist = palist->Next;
|
palist = palist->Next;
|
||||||
}
|
}
|
||||||
LocalFree(palist);
|
LocalFree(palist_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -181,17 +182,18 @@ int pafish_check_adapter_name(char * name) {
|
|||||||
ret = GetAdaptersAddresses(AF_UNSPEC, 0, 0, 0, &alist_size);
|
ret = GetAdaptersAddresses(AF_UNSPEC, 0, 0, 0, &alist_size);
|
||||||
if (ret == ERROR_BUFFER_OVERFLOW) {
|
if (ret == ERROR_BUFFER_OVERFLOW) {
|
||||||
IP_ADAPTER_ADDRESSES *palist = (IP_ADAPTER_ADDRESSES*)LocalAlloc(LMEM_ZEROINIT, alist_size);
|
IP_ADAPTER_ADDRESSES *palist = (IP_ADAPTER_ADDRESSES*)LocalAlloc(LMEM_ZEROINIT, alist_size);
|
||||||
|
void * palist_free = palist;
|
||||||
if (palist) {
|
if (palist) {
|
||||||
if (GetAdaptersAddresses(AF_UNSPEC, 0, 0, palist, &alist_size) == ERROR_SUCCESS) {
|
if (GetAdaptersAddresses(AF_UNSPEC, 0, 0, palist, &alist_size) == ERROR_SUCCESS) {
|
||||||
while (palist) {
|
while (palist) {
|
||||||
if (wcsstr(palist->Description, aux)) {
|
if (wcsstr(palist->Description, aux)) {
|
||||||
LocalFree(palist);
|
LocalFree(palist_free);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
palist = palist->Next;
|
palist = palist->Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LocalFree(palist);
|
LocalFree(palist_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user