To: vim-dev@vim.org Subject: Patch 7.2a.003 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 7.2a.003 Problem: Leaking memory when using ":file name" and using access control lists. Solution: Invoke mch_free_acl() in vim_rename(). (Dominique Pelle) Files: src/fileio.c *** ../vim-7.2a.002/src/fileio.c Tue Jun 24 23:02:45 2008 --- src/fileio.c Thu Jun 26 21:53:00 2008 *************** *** 2456,2462 **** /* * Work around a weird problem: When a file has two links (only * possible on NTFS) and we write through one link, then stat() it ! * throught the other link, the timestamp information may be wrong. * It's correct again after reading the file, thus reset the timestamp * here. */ --- 2456,2462 ---- /* * Work around a weird problem: When a file has two links (only * possible on NTFS) and we write through one link, then stat() it ! * through the other link, the timestamp information may be wrong. * It's correct again after reading the file, thus reset the timestamp * here. */ *************** *** 3906,3912 **** #ifdef VMS vms_remove_version(fname); /* remove version */ #endif ! /* Default: write the the file directly. May write to a temp file for * multi-byte conversion. */ wfname = fname; --- 3906,3912 ---- #ifdef VMS vms_remove_version(fname); /* remove version */ #endif ! /* Default: write the file directly. May write to a temp file for * multi-byte conversion. */ wfname = fname; *************** *** 5770,5776 **** #endif /* ! * add extention to file name - change path/fo.o.h to path/fo.o.h.ext or * fo_o_h.ext for MSDOS or when shortname option set. * * Assumed that fname is a valid name found in the filesystem we assure that --- 5770,5776 ---- #endif /* ! * add extension to file name - change path/fo.o.h to path/fo.o.h.ext or * fo_o_h.ext for MSDOS or when shortname option set. * * Assumed that fname is a valid name found in the filesystem we assure that *************** *** 5952,5958 **** #endif /* ! * Append the extention. * ext can start with '.' and cannot exceed 3 more characters. */ STRCPY(s, ext); --- 5952,5958 ---- #endif /* ! * Append the extension. * ext can start with '.' and cannot exceed 3 more characters. */ STRCPY(s, ext); *************** *** 6164,6170 **** --- 6164,6175 ---- #endif fd_in = mch_open((char *)from, O_RDONLY|O_EXTRA, 0); if (fd_in == -1) + { + #ifdef HAVE_ACL + mch_free_acl(acl); + #endif return -1; + } /* Create the new file with same permissions as the original. */ fd_out = mch_open((char *)to, *************** *** 6172,6185 **** if (fd_out == -1) { close(fd_in); return -1; } buffer = (char *)alloc(BUFSIZE); if (buffer == NULL) { - close(fd_in); close(fd_out); return -1; } --- 6177,6196 ---- if (fd_out == -1) { close(fd_in); + #ifdef HAVE_ACL + mch_free_acl(acl); + #endif return -1; } buffer = (char *)alloc(BUFSIZE); if (buffer == NULL) { close(fd_out); + close(fd_in); + #ifdef HAVE_ACL + mch_free_acl(acl); + #endif return -1; } *************** *** 6204,6209 **** --- 6215,6221 ---- #endif #ifdef HAVE_ACL mch_set_acl(to, acl); + mch_free_acl(acl); #endif if (errmsg != NULL) { *** ../vim-7.2a.002/src/version.c Fri Jun 27 20:25:15 2008 --- src/version.c Fri Jun 27 20:39:54 2008 *************** *** 678,679 **** --- 678,681 ---- { /* Add new patch number below this line */ + /**/ + 3, /**/ -- hundred-and-one symptoms of being an internet addict: 97. Your mother tells you to remember something, and you look for a File/Save command. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///