diff --git a/src/WINNT/afsd/smb3.c b/src/WINNT/afsd/smb3.c index 96b2201a2e..4273525763 100644 --- a/src/WINNT/afsd/smb3.c +++ b/src/WINNT/afsd/smb3.c @@ -2365,8 +2365,9 @@ nextEntry: * or if something went wrong, close the search. */ /* ((searchFlags & 1) || ((searchFlags & 2) && eos) */ - if ((searchFlags & 1) || (returnedNames == 0) - || code != 0) smb_DeleteDirSearch(dsp); + if ((searchFlags & 1) || (returnedNames == 0) || ((searchFlags & 2) && + eos) || code != 0) + smb_DeleteDirSearch(dsp); if (code) smb_SendTran2Error(vcp, p, opx, code); else {