Handle some failure cases in better way.
Modified: trunk/reactos/lib/iphlpapi/ifenum_reactos.c
_____
Modified: trunk/reactos/lib/iphlpapi/ifenum_reactos.c
--- trunk/reactos/lib/iphlpapi/ifenum_reactos.c 2005-09-22 20:24:50 UTC
(rev 17985)
+++ trunk/reactos/lib/iphlpapi/ifenum_reactos.c 2005-09-22 20:36:07 UTC
(rev 17986)
@@ -304,13 +304,14 @@
static BOOL isLoopback( HANDLE tcpFile, TDIEntityID *loop_maybe ) {
IFEntrySafelySized entryInfo;
+ NTSTATUS status;
- tdiGetMibForIfEntity( tcpFile,
- loop_maybe,
- &entryInfo );
+ status = tdiGetMibForIfEntity( tcpFile,
+ loop_maybe,
+ &entryInfo );
- return !entryInfo.ent.if_type ||
- entryInfo.ent.if_type == IFENT_SOFTWARE_LOOPBACK;
+ return NT_SUCCESS(status) && (!entryInfo.ent.if_type ||
+ entryInfo.ent.if_type == IFENT_SOFTWARE_LOOPBACK);
}
NTSTATUS tdiGetEntityType( HANDLE tcpFile, TDIEntityID *ent, PULONG
type ) {
@@ -388,12 +389,18 @@
}
}
}
- }
- *infoSet = infoSetInt;
- *numInterfaces = curInterf;
+ if (NT_SUCCESS(status)) {
+ *infoSet = infoSetInt;
+ *numInterfaces = curInterf;
+ } else {
+ HeapFree(GetProcessHeap(), 0, infoSetInt);
+ }
- return STATUS_SUCCESS;
+ return status;
+ } else {
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
}
static DWORD getNumInterfacesInt(BOOL onlyNonLoopback)