[OpenAFS-devel] Leaks W2000 during directory scan.

James Peterson jimpeter@us.ibm.com
Thu, 8 Feb 2001 14:52:41 -0800


This is a patch to AFS Open 1.0.1

W2K does not send FindClose when doing a directory scan.
When smb_ReceiveTran2SearchDir() processes FindFirst or FindNext the last
SMB call is known by an empty directory (no file names).  Unfortunately Bit
1 of the Flags is not set (close search if end of search) and the routine
and smb_DeleteDirSearch() is never called.  This patch looks for 0 file
names left to determine that we are done with the directory scan.   This
problem was reproducible while trying to scan a directory with symbolic
links.

Running a directory scan (DOS window) and file cache size of 5 MB:
With the memory leak patch, the program will grow 5.3MB.
Without the patch, the program will grow


\src\winnt\afsd\smb3.c

-2368,6  +2368,6
         * or if something went wrong, close the search.
         */
+        if ((searchFlags & 1) || (returnedNames == 0) //Release dsp when
names==0, W2k doesn't return FindClose like NT                 -         if
((searchFlags & 1) || ((searchFlags & 2) && eos)
          || code != 0) smb_DeleteDirSearch(dsp);
     if (code)
          smb_SendTran2Error(vcp, p, opx, code);

James Peterson
"Integrity is the base of excellence."