diff --git a/src/WINNT/afsd/smb3.c b/src/WINNT/afsd/smb3.c index 0fa49bc845..4e026d41ab 100644 --- a/src/WINNT/afsd/smb3.c +++ b/src/WINNT/afsd/smb3.c @@ -2363,8 +2363,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 {