Bug 505725 nsWifiMonitor::DoScan seems to leak ndis_handle in all failure cases

r=dougt
This commit is contained in:
timeless 2009-08-12 11:49:53 +02:00
parent 4544f431e2
commit f0125ad362

View File

@ -382,9 +382,13 @@ nsWifiMonitor::DoScan()
// Get the data.
BYTE *buffer = (BYTE*)malloc(oid_buffer_size_);
if (buffer == NULL)
if (buffer == NULL) {
#ifdef WINCE
CloseHandle(ndis_handle);
#endif
return NS_ERROR_OUT_OF_MEMORY;
}
DWORD bytes_out;
int result;
@ -491,9 +495,13 @@ nsWifiMonitor::DoScan()
PRUint32 resultCount = lastAccessPoints.Count();
nsIWifiAccessPoint** result = static_cast<nsIWifiAccessPoint**> (nsMemory::Alloc(sizeof(nsIWifiAccessPoint*) * resultCount));
if (!result)
if (!result) {
#ifdef WINCE
CloseHandle(ndis_handle);
#endif
return NS_ERROR_OUT_OF_MEMORY;
}
for (PRUint32 i = 0; i < resultCount; i++)
result[i] = lastAccessPoints[i];