]>
Commit | Line | Data |
---|---|---|
3ab71051 ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.294 | |
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.294 | |
11 | Problem: Leaking memory when executing a shell command. | |
12 | Solution: Free memory when not able to save for undo. (Dominique Pelle) | |
13 | Files: src/ex_cmds.c | |
14 | ||
15 | *** ../vim-7.1.293/src/ex_cmds.c Mon Feb 18 19:41:40 2008 | |
16 | --- src/ex_cmds.c Sun Apr 13 13:20:15 2008 | |
17 | *************** | |
18 | *** 1160,1165 **** | |
19 | --- 1166,1172 ---- | |
20 | if (!do_out) | |
21 | msg_putchar('\n'); | |
22 | ||
23 | + /* Create the shell command in allocated memory. */ | |
24 | cmd_buf = make_filter_cmd(cmd, itmp, otmp); | |
25 | if (cmd_buf == NULL) | |
26 | goto filterend; | |
27 | *************** | |
28 | *** 1180,1186 **** | |
29 | --- 1187,1196 ---- | |
30 | if (do_out) | |
31 | { | |
32 | if (u_save((linenr_T)(line2), (linenr_T)(line2 + 1)) == FAIL) | |
33 | + { | |
34 | + vim_free(cmd_buf); | |
35 | goto error; | |
36 | + } | |
37 | redraw_curbuf_later(VALID); | |
38 | } | |
39 | read_linecount = curbuf->b_ml.ml_line_count; | |
40 | *************** | |
41 | *** 4471,4477 **** | |
42 | /* | |
43 | * The new text is build up step by step, to avoid too much | |
44 | * copying. There are these pieces: | |
45 | ! * sub_firstline The old text, unmodifed. | |
46 | * copycol Column in the old text where we started | |
47 | * looking for a match; from here old text still | |
48 | * needs to be copied to the new text. | |
49 | --- 4481,4487 ---- | |
50 | /* | |
51 | * The new text is build up step by step, to avoid too much | |
52 | * copying. There are these pieces: | |
53 | ! * sub_firstline The old text, unmodified. | |
54 | * copycol Column in the old text where we started | |
55 | * looking for a match; from here old text still | |
56 | * needs to be copied to the new text. | |
57 | *** ../vim-7.1.293/src/version.c Wed Apr 9 15:48:08 2008 | |
58 | --- src/version.c Wed May 7 13:07:48 2008 | |
59 | *************** | |
60 | *** 668,669 **** | |
61 | --- 673,676 ---- | |
62 | { /* Add new patch number below this line */ | |
63 | + /**/ | |
64 | + 294, | |
65 | /**/ | |
66 | ||
67 | -- | |
68 | It's not hard to meet expenses, they're everywhere. | |
69 | ||
70 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
71 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
72 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
73 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |