[DEVMGR] - Actually fail on error in AllocAndLoadStringsCat (CID 716793/716794)

[IPHLPAPI] - Fix a use after free in getNthInterfaceEntity (CID 716795 - partly reverts r53190). Fix a possible double free in getArpTable (CID 716796).

svn path=/trunk/; revision=57127
This commit is contained in:
Thomas Faber 2012-08-22 09:39:57 +00:00
parent a4a967f486
commit b2fa124766
3 changed files with 9 additions and 9 deletions

View file

@ -130,6 +130,7 @@ AllocAndLoadStringsCat(OUT LPWSTR *lpTarget,
if (!(Ret = LoadStringW(hInst, uID[i], s, ln)))
{
LocalFree((HLOCAL)(*lpTarget));
return 0;
}
s += Ret;

View file

@ -287,12 +287,12 @@ DWORD getNthInterfaceEntity( HANDLE tcpFile, DWORD index, TDIEntityID *ent ) {
TRACE("Index %d is entity #%d - %04x:%08x\n", index, i,
entitySet[i].tei_entity, entitySet[i].tei_instance );
tdiFreeThingSet( entitySet );
if( numInterfaces == index && i < numEntities ) {
memcpy( ent, &entitySet[i], sizeof(*ent) );
tdiFreeThingSet( entitySet );
return STATUS_SUCCESS;
} else {
tdiFreeThingSet( entitySet );
return STATUS_UNSUCCESSFUL;
}
}

View file

@ -582,13 +582,12 @@ PMIB_IPNETTABLE getArpTable(void)
(PVOID *)&AdapterArpTable,
&returnSize );
if( status == STATUS_SUCCESS ) {
for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ )
IpArpTable->table[CurrIdx] = AdapterArpTable[TmpIdx];
}
if( AdapterArpTable ) tdiFreeThingSet( AdapterArpTable );
}
if( status == STATUS_SUCCESS ) {
for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ )
IpArpTable->table[CurrIdx] = AdapterArpTable[TmpIdx];
tdiFreeThingSet( AdapterArpTable );
}
}
}
closeTcpFile( tcpFile );