[ros-diffs] [cgutman] 35946: - 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

cgutman at svn.reactos.org cgutman at svn.reactos.org
Thu Sep 4 21:08:09 CEST 2008


Author: cgutman
Date: Thu Sep  4 14:08:08 2008
New Revision: 35946

URL: http://svn.reactos.org/svn/reactos?rev=35946&view=rev
Log:
 - 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

Modified:
    branches/aicom-network-fixes/drivers/network/ndis/ndis/stubs.c

Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/stubs.c
URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/network/ndis/ndis/stubs.c?rev=35946&r1=35945&r2=35946&view=diff
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/stubs.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/stubs.c [iso-8859-1] Thu Sep  4 14:08:08 2008
@@ -331,10 +331,12 @@
     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



More information about the Ros-diffs mailing list