Frédéric Delanoy frederic.delanoy@gmail.com writes:
@@ -1520,8 +1521,8 @@ DWORD WINAPI GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL sizeof(MIB_IPADDRROW), IpAddrTableSorter); ret = NO_ERROR; }
}HeapFree(GetProcessHeap(), 0, table);
- HeapFree(GetProcessHeap(), 0, table); }
That's not the correct fix.
Hi Frédéric,
thanks for the patch. Allow me to elaborate:
On Tue, Nov 6, 2012 at 6:05 AM, Alexandre Julliard julliard@winehq.orgwrote:
Frédéric Delanoy frederic.delanoy@gmail.com writes:
@@ -1520,8 +1521,8 @@ DWORD WINAPI GetIpAddrTable(PMIB_IPADDRTABLE
pIpAddrTable, PULONG pdwSize, BOOL
sizeof(MIB_IPADDRROW), IpAddrTableSorter); ret = NO_ERROR; }
}HeapFree(GetProcessHeap(), 0, table);
- HeapFree(GetProcessHeap(), 0, table); }
That's not the correct fix.
The correct place to fix is getIpAddrTable in ifenum.c, so that should it fail, it frees the memory it allocated. This was obviously an oversight on my part. See the for loop here: http://source.winehq.org/source/dlls/iphlpapi/ifenum.c#L735
This loop terminates if something fails, so after the for loop is an ideal place to add a HeapFree. In this way, the callers (GetIpAddrTable is but one) never have to cope with freeing memory when getIpAddrTable fails. --Juan