diff --git a/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp b/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp index f51e31e0b4..831cf24759 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;