summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2007-09-30 20:11:26 +0000
committerBram Moolenaar <Bram@vim.org>2007-09-30 20:11:26 +0000
commitecf4de5d69f6e965e1f376f23de5ebc43ce60911 (patch)
tree557797d043c90509a972338ba1505dae6dabc325 /src/ex_getln.c
parentd089d9b33ac62ccc2783928a66c8f20499470920 (diff)
updated for version 7.1-127v7.1.127
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index f417619894..7ce48a891a 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -3316,6 +3316,10 @@ nextwild(xp, type, options)
* 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,7 +3404,7 @@ ExpandOne(xp, str, orig, options, mode)
return NULL;
}
-/* free old names */
+ /* free old names */
if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST)
{
FreeWild(xp->xp_numfiles, xp->xp_files);
@@ -3541,6 +3545,10 @@ ExpandOne(xp, str, orig, options, mode)
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;
}