From 16427a14824a7a453cb547498fc359e6d6b2e989 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 4 Sep 2008 19:08:08 +0000 Subject: [PATCH] - 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 --- drivers/network/ndis/ndis/stubs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/network/ndis/ndis/stubs.c b/drivers/network/ndis/ndis/stubs.c index a22dc167c3d..907dd402d0b 100644 --- a/drivers/network/ndis/ndis/stubs.c +++ b/drivers/network/ndis/ndis/stubs.c @@ -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