Windows: AFSInitPIOCtlDirectoryCB free in try_exit
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 17 Oct 2011 13:26:13 +0000 (09:26 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 25 Oct 2011 17:48:53 +0000 (10:48 -0700)
Process all conditional release of allocated memory on
failure within the try_exit on failure.

Change-Id: I4a29f6e9d2506c00713558849c49c377a74d607a
Reviewed-on: http://gerrit.openafs.org/5625
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp

index f51e31e..831cf24 100644 (file)
@@ -5448,10 +5448,6 @@ AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ObjectInfo)
         if( pNonPagedDirEntry == NULL)
         {
 
-            AFSExFreePool( pDirNode);
-
-            AFSDeleteObjectInfo( pObjectInfoCB);
-
             try_return( ntStatus = STATUS_INSUFFICIENT_RESOURCES);
         }
 
@@ -5492,7 +5488,21 @@ AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ObjectInfo)
 
 try_exit:
 
-        NOTHING;
+        if ( !NT_SUCCESS( ntStatus))
+        {
+
+            if ( pDirNode != NULL)
+            {
+
+                AFSExFreePool( pDirNode);
+            }
+
+            if ( pObjectInfoCB != NULL)
+            {
+
+                AFSDeleteObjectInfo( pObjectInfoCB);
+            }
+        }
     }
 
     return ntStatus;