To: vim-dev@vim.org Subject: About patch 7.1.127 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 7.1.127 Problem: Memory leak when doing cmdline completion. (Dominique Pelle) Solution: Free "orig" argument of ExpandOne() when it's not used. Files: src/ex_getln.c *** ../vim-7.1.126/src/ex_getln.c Sat Sep 29 14:15:00 2007 --- src/ex_getln.c Sun Sep 30 17:55:47 2007 *************** *** 3316,3321 **** --- 3316,3325 ---- * Return a pointer to alloced memory containing the new string. * Return NULL for failure. * + * "orig" is the originally expanded string, copied to allocated memory. It + * should either be kept in orig_save or freed. When "mode" is WILD_NEXT or + * WILD_PREV "orig" should be NULL. + * * Results are cached in xp->xp_files and xp->xp_numfiles, except when "mode" * is WILD_EXPAND_FREE or WILD_ALL. * *************** *** 3400,3406 **** return NULL; } ! /* free old names */ if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) { FreeWild(xp->xp_numfiles, xp->xp_files); --- 3404,3410 ---- return NULL; } ! /* free old names */ if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) { FreeWild(xp->xp_numfiles, xp->xp_files); *************** *** 3540,3545 **** --- 3544,3553 ---- if (mode == WILD_EXPAND_FREE || mode == WILD_ALL) ExpandCleanup(xp); + + /* Free "orig" if it wasn't stored in "orig_save". */ + if (orig != orig_save) + vim_free(orig); return ss; } *** ../vim-7.1.126/src/version.c Sun Sep 30 14:00:41 2007 --- src/version.c Sun Sep 30 14:20:14 2007 *************** *** 668,669 **** --- 668,671 ---- { /* Add new patch number below this line */ + /**/ + 127, /**/ -- A M00se once bit my sister ... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///