Windows: AFSEvaluateTargetByName free buffer if no return
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 17 Oct 2011 13:22:53 +0000 (09:22 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 25 Oct 2011 04:36:13 +0000 (21:36 -0700)
For consistency with other functions in AFSCommSupport
modify AFSEvaluateTargetByName to free the DirEntry on
completion if the caller has not provided an out parameter
to accept it.

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

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

index 8f5d334..3f05e8b 100644 (file)
@@ -1638,7 +1638,16 @@ AFSEvaluateTargetByName( IN GUID *AuthGroup,
         // Pass back the dir enum entry
         //
 
-        *DirEnumEntry = pDirEnumCB;
+        if( DirEnumEntry != NULL)
+        {
+
+            *DirEnumEntry = pDirEnumCB;
+        }
+        else
+        {
+
+            AFSExFreePool( pDirEnumCB);
+        }
 
 try_exit: