Author: tfaber
Date: Tue May 10 13:59:41 2016
New Revision: 71306
URL:
http://svn.reactos.org/svn/reactos?rev=71306&view=rev
Log:
[IPHLPAPI]
- Fix memory leaks in getInterfaceInfoSet (CIDs 716370 and 716371)
- Fix a benign uninitialized variable use (CID 500783)
CORE-11224 #resolve
Modified:
trunk/reactos/dll/win32/iphlpapi/ifenum_reactos.c
Modified: trunk/reactos/dll/win32/iphlpapi/ifenum_reactos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/ifenum_…
==============================================================================
--- trunk/reactos/dll/win32/iphlpapi/ifenum_reactos.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/iphlpapi/ifenum_reactos.c [iso-8859-1] Tue May 10 13:59:41
2016
@@ -155,7 +155,7 @@
IFInfo **infoSet,
PDWORD numInterfaces ) {
DWORD numEntities;
- TDIEntityID *entIDSet = 0;
+ TDIEntityID *entIDSet = NULL;
NTSTATUS status = tdiGetEntityIDSet( tcpFile, &entIDSet, &numEntities );
IFInfo *infoSetInt = 0;
int curInterf = 0, i;
@@ -187,7 +187,7 @@
if( NT_SUCCESS(status) )
status = tdiGetIpAddrsForIpEntity
( tcpFile, &ip_ent, &addrs, &numAddrs );
- for( j = 0; j < numAddrs && NT_SUCCESS(status); j++ ) {
+ for( j = 0; NT_SUCCESS(status) && j < numAddrs; j++ ) {
TRACE("ADDR %d: index %d (target %d)\n", j,
addrs[j].iae_index, infoSetInt[curInterf].if_info.ent.if_index);
if( addrs[j].iae_index ==
infoSetInt[curInterf].if_info.ent.if_index ) {
@@ -198,6 +198,8 @@
break;
}
}
+ if ( NT_SUCCESS(status) )
+ tdiFreeThingSet(addrs);
}
}
}
@@ -213,6 +215,7 @@
return status;
} else {
+ tdiFreeThingSet(entIDSet);
return STATUS_INSUFFICIENT_RESOURCES;
}
}