[IPHLPAPI]

- Fix memory leaks in getInterfaceInfoSet (CIDs 716370 and 716371)
- Fix a benign uninitialized variable use (CID 500783)
CORE-11224 #resolve

svn path=/trunk/; revision=71306
This commit is contained in:
Thomas Faber 2016-05-10 13:59:41 +00:00
parent f40cfb8b12
commit 418ef674ed

View file

@ -155,7 +155,7 @@ static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile,
IFInfo **infoSet, IFInfo **infoSet,
PDWORD numInterfaces ) { PDWORD numInterfaces ) {
DWORD numEntities; DWORD numEntities;
TDIEntityID *entIDSet = 0; TDIEntityID *entIDSet = NULL;
NTSTATUS status = tdiGetEntityIDSet( tcpFile, &entIDSet, &numEntities ); NTSTATUS status = tdiGetEntityIDSet( tcpFile, &entIDSet, &numEntities );
IFInfo *infoSetInt = 0; IFInfo *infoSetInt = 0;
int curInterf = 0, i; int curInterf = 0, i;
@ -187,7 +187,7 @@ static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile,
if( NT_SUCCESS(status) ) if( NT_SUCCESS(status) )
status = tdiGetIpAddrsForIpEntity status = tdiGetIpAddrsForIpEntity
( tcpFile, &ip_ent, &addrs, &numAddrs ); ( 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); 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 == if( addrs[j].iae_index ==
infoSetInt[curInterf].if_info.ent.if_index ) { infoSetInt[curInterf].if_info.ent.if_index ) {
@ -198,6 +198,8 @@ static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile,
break; break;
} }
} }
if ( NT_SUCCESS(status) )
tdiFreeThingSet(addrs);
} }
} }
} }
@ -213,6 +215,7 @@ static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile,
return status; return status;
} else { } else {
tdiFreeThingSet(entIDSet);
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
} }