- Fix cleanup code

- We could possibly end up there with a NULL FileHandleObject and return a garbage FileHandle or crash
 - Now we always return a NULL FileHandle when we fail and free FileHandleObject if it has been allocated

svn path=/branches/aicom-network-fixes/; revision=35946
This commit is contained in:
Cameron Gutman 2008-09-04 19:08:08 +00:00
parent 4ff5fc5caa
commit 16427a1482

View file

@ -331,10 +331,12 @@ cleanup:
ExFreePool ( FullFileName.Buffer );
FullFileName.Buffer = NULL;
}
if ( !NT_SUCCESS(*Status) && FileHandleObject != NULL )
if ( !NT_SUCCESS(*Status) )
{
ExFreePool ( FileHandleObject );
FileHandleObject = NULL;
if( FileHandleObject ) {
ExFreePool ( FileHandleObject );
FileHandleObject = NULL;
}
*FileHandle = NULL;
}
else