summaryrefslogtreecommitdiffstats
path: root/vim/vim-7.2/7.2.125
blob: 460bdea581a0e52e68bfe2ed86fd76ce9673bc41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
To: vim-dev@vim.org
Subject: Patch 7.2.125
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.125
Problem:    Leaking memory when reading XPM bitmap for a sign.
Solution:   Don't allocate the memory twice. (Dominique Pelle)
Files:      src/gui_x11.c


*** ../vim-7.2.124/src/gui_x11.c	Wed Nov 12 13:07:48 2008
--- src/gui_x11.c	Sun Feb 22 21:58:19 2009
***************
*** 1587,1592 ****
--- 1587,1594 ----
      XtCloseDisplay(gui.dpy);
      gui.dpy = NULL;
      vimShell = (Widget)0;
+     vim_free(gui_argv);
+     gui_argv = NULL;
  }
  
  /*
***************
*** 1761,1766 ****
--- 1763,1770 ----
       * says that this isn't needed when exiting, so just skip it. */
      XtCloseDisplay(gui.dpy);
  #endif
+     vim_free(gui_argv);
+     gui_argv = NULL;
  }
  
  /*
***************
*** 3439,3485 ****
      char_u	    *signfile;
  {
      XpmAttributes   attrs;
!     XImage	    *sign;
      int		    status;
  
      /*
       * Setup the color substitution table.
       */
-     sign = NULL;
      if (signfile[0] != NUL && signfile[0] != '-')
      {
! 	sign = (XImage *)alloc(sizeof(XImage));
! 	if (sign != NULL)
  	{
! 	    XpmColorSymbol color[5] =
! 	    {
! 		{"none", NULL, 0},
! 		{"iconColor1", NULL, 0},
! 		{"bottomShadowColor", NULL, 0},
! 		{"topShadowColor", NULL, 0},
! 		{"selectColor", NULL, 0}
! 	    };
! 	    attrs.valuemask = XpmColorSymbols;
! 	    attrs.numsymbols = 2;
! 	    attrs.colorsymbols = color;
! 	    attrs.colorsymbols[0].pixel = gui.back_pixel;
! 	    attrs.colorsymbols[1].pixel = gui.norm_pixel;
! 	    status = XpmReadFileToImage(gui.dpy, (char *)signfile,
  							 &sign, NULL, &attrs);
! 
! 	    if (status == 0)
! 	    {
! 		/* Sign width is fixed at two columns now.
! 		if (sign->width > gui.sign_width)
! 		    gui.sign_width = sign->width + 8; */
! 	    }
! 	    else
! 	    {
! 		vim_free(sign);
! 		sign = NULL;
! 		EMSG(_(e_signdata));
! 	    }
  	}
      }
  
      return (void *)sign;
--- 3443,3479 ----
      char_u	    *signfile;
  {
      XpmAttributes   attrs;
!     XImage	    *sign = NULL;
      int		    status;
  
      /*
       * Setup the color substitution table.
       */
      if (signfile[0] != NUL && signfile[0] != '-')
      {
! 	XpmColorSymbol color[5] =
  	{
! 	    {"none", NULL, 0},
! 	    {"iconColor1", NULL, 0},
! 	    {"bottomShadowColor", NULL, 0},
! 	    {"topShadowColor", NULL, 0},
! 	    {"selectColor", NULL, 0}
! 	};
! 	attrs.valuemask = XpmColorSymbols;
! 	attrs.numsymbols = 2;
! 	attrs.colorsymbols = color;
! 	attrs.colorsymbols[0].pixel = gui.back_pixel;
! 	attrs.colorsymbols[1].pixel = gui.norm_pixel;
! 	status = XpmReadFileToImage(gui.dpy, (char *)signfile,
  							 &sign, NULL, &attrs);
! 	if (status == 0)
! 	{
! 	    /* Sign width is fixed at two columns now.
! 	    if (sign->width > gui.sign_width)
! 	        gui.sign_width = sign->width + 8; */
  	}
+ 	else
+ 	    EMSG(_(e_signdata));
      }
  
      return (void *)sign;
***************
*** 3489,3496 ****
  gui_mch_destroy_sign(sign)
      void *sign;
  {
!     XFree(((XImage *)sign)->data);
!     vim_free(sign);
  }
  #endif
  
--- 3483,3489 ----
  gui_mch_destroy_sign(sign)
      void *sign;
  {
!     XDestroyImage((XImage*)sign);
  }
  #endif
  
*** ../vim-7.2.124/src/version.c	Mon Feb 23 00:53:35 2009
--- src/version.c	Tue Feb 24 04:09:33 2009
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     125,
  /**/

-- 
I have a watch cat! Just break in and she'll watch.

 /// 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    ///