4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Leaking memory when reading XPM bitmap for a sign.
12 Solution: Don't allocate the memory twice. (Dominique Pelle)
16 *** ../vim-7.2.124/src/gui_x11.c Wed Nov 12 13:07:48 2008
17 --- src/gui_x11.c Sun Feb 22 21:58:19 2009
21 XtCloseDisplay(gui.dpy);
32 * says that this isn't needed when exiting, so just skip it. */
33 XtCloseDisplay(gui.dpy);
49 * Setup the color substitution table.
52 if (signfile[0] != NUL && signfile[0] != '-')
54 ! sign = (XImage *)alloc(sizeof(XImage));
57 ! XpmColorSymbol color[5] =
60 ! {"iconColor1", NULL, 0},
61 ! {"bottomShadowColor", NULL, 0},
62 ! {"topShadowColor", NULL, 0},
63 ! {"selectColor", NULL, 0}
65 ! attrs.valuemask = XpmColorSymbols;
66 ! attrs.numsymbols = 2;
67 ! attrs.colorsymbols = color;
68 ! attrs.colorsymbols[0].pixel = gui.back_pixel;
69 ! attrs.colorsymbols[1].pixel = gui.norm_pixel;
70 ! status = XpmReadFileToImage(gui.dpy, (char *)signfile,
75 ! /* Sign width is fixed at two columns now.
76 ! if (sign->width > gui.sign_width)
77 ! gui.sign_width = sign->width + 8; */
83 ! EMSG(_(e_signdata));
93 ! XImage *sign = NULL;
97 * Setup the color substitution table.
99 if (signfile[0] != NUL && signfile[0] != '-')
101 ! XpmColorSymbol color[5] =
104 ! {"iconColor1", NULL, 0},
105 ! {"bottomShadowColor", NULL, 0},
106 ! {"topShadowColor", NULL, 0},
107 ! {"selectColor", NULL, 0}
109 ! attrs.valuemask = XpmColorSymbols;
110 ! attrs.numsymbols = 2;
111 ! attrs.colorsymbols = color;
112 ! attrs.colorsymbols[0].pixel = gui.back_pixel;
113 ! attrs.colorsymbols[1].pixel = gui.norm_pixel;
114 ! status = XpmReadFileToImage(gui.dpy, (char *)signfile,
115 &sign, NULL, &attrs);
118 ! /* Sign width is fixed at two columns now.
119 ! if (sign->width > gui.sign_width)
120 ! gui.sign_width = sign->width + 8; */
123 + EMSG(_(e_signdata));
129 gui_mch_destroy_sign(sign)
132 ! XFree(((XImage *)sign)->data);
138 gui_mch_destroy_sign(sign)
141 ! XDestroyImage((XImage*)sign);
145 *** ../vim-7.2.124/src/version.c Mon Feb 23 00:53:35 2009
146 --- src/version.c Tue Feb 24 04:09:33 2009
150 { /* Add new patch number below this line */
156 I have a watch cat! Just break in and she'll watch.
158 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
159 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
160 \\\ download, build and distribute -- http://www.A-A-P.org ///
161 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///