From: Jeffrey Altman Date: Mon, 17 Oct 2011 13:26:13 +0000 (-0400) Subject: Windows: AFSInitPIOCtlDirectoryCB free in try_exit X-Git-Tag: upstream/1.8.0_pre1^2~3124 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ada5908ca1ed8cfa7bfc42890ac5edc73769ae4c;p=packages%2Fo%2Fopenafs.git Windows: AFSInitPIOCtlDirectoryCB free in try_exit 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 Reviewed-by: Rod Widdowson Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp b/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp index f51e31e0b..831cf2475 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp @@ -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;