]>
Commit | Line | Data |
---|---|---|
25f687b8 AM |
1 | To: vim-dev@vim.org |
2 | Subject: About patch 7.1.127 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.127 | |
11 | Problem: Memory leak when doing cmdline completion. (Dominique Pelle) | |
12 | Solution: Free "orig" argument of ExpandOne() when it's not used. | |
13 | Files: src/ex_getln.c | |
14 | ||
15 | ||
16 | *** ../vim-7.1.126/src/ex_getln.c Sat Sep 29 14:15:00 2007 | |
17 | --- src/ex_getln.c Sun Sep 30 17:55:47 2007 | |
18 | *************** | |
19 | *** 3316,3321 **** | |
20 | --- 3316,3325 ---- | |
21 | * Return a pointer to alloced memory containing the new string. | |
22 | * Return NULL for failure. | |
23 | * | |
24 | + * "orig" is the originally expanded string, copied to allocated memory. It | |
25 | + * should either be kept in orig_save or freed. When "mode" is WILD_NEXT or | |
26 | + * WILD_PREV "orig" should be NULL. | |
27 | + * | |
28 | * Results are cached in xp->xp_files and xp->xp_numfiles, except when "mode" | |
29 | * is WILD_EXPAND_FREE or WILD_ALL. | |
30 | * | |
31 | *************** | |
32 | *** 3400,3406 **** | |
33 | return NULL; | |
34 | } | |
35 | ||
36 | ! /* free old names */ | |
37 | if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) | |
38 | { | |
39 | FreeWild(xp->xp_numfiles, xp->xp_files); | |
40 | --- 3404,3410 ---- | |
41 | return NULL; | |
42 | } | |
43 | ||
44 | ! /* free old names */ | |
45 | if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) | |
46 | { | |
47 | FreeWild(xp->xp_numfiles, xp->xp_files); | |
48 | *************** | |
49 | *** 3540,3545 **** | |
50 | --- 3544,3553 ---- | |
51 | ||
52 | if (mode == WILD_EXPAND_FREE || mode == WILD_ALL) | |
53 | ExpandCleanup(xp); | |
54 | + | |
55 | + /* Free "orig" if it wasn't stored in "orig_save". */ | |
56 | + if (orig != orig_save) | |
57 | + vim_free(orig); | |
58 | ||
59 | return ss; | |
60 | } | |
61 | *** ../vim-7.1.126/src/version.c Sun Sep 30 14:00:41 2007 | |
62 | --- src/version.c Sun Sep 30 14:20:14 2007 | |
63 | *************** | |
64 | *** 668,669 **** | |
65 | --- 668,671 ---- | |
66 | { /* Add new patch number below this line */ | |
67 | + /**/ | |
68 | + 127, | |
69 | /**/ | |
70 | ||
71 | -- | |
72 | A M00se once bit my sister ... | |
73 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
74 | ||
75 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
76 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
77 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
78 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |