2 Subject: Patch 7.2.036 (extra)
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Mismatches between alloc/malloc, free/vim_free,
13 Solution: Use the right function. (Dominique Pelle)
14 Files: src/gui_riscos.c, src/gui_w48.c, src/mbyte.c, src/os_vms.c,
15 src/os_w32exe.c, src/os_win16.c
18 *** ../vim-7.2.035/src/gui_riscos.c Thu May 10 19:33:26 2007
19 --- src/gui_riscos.c Wed Nov 12 11:47:54 2008
22 gui_mch_set_shellsize(width, height, min_width, min_height, base_width, base_height, direction)
23 int width; /* In OS units */
25 ! int min_width; /* Smallest permissable window size (ignored) */
27 int base_width; /* Space for scroll bars, etc */
30 gui_mch_set_shellsize(width, height, min_width, min_height, base_width, base_height, direction)
31 int width; /* In OS units */
33 ! int min_width; /* Smallest permissible window size (ignored) */
35 int base_width; /* Space for scroll bars, etc */
39 if (strncmp(file, "ZapFont\015", 8) == 0)
40 return file; /* Loaded OK! */
43 return NULL; /* Not a valid font file */
47 if (strncmp(file, "ZapFont\015", 8) == 0)
48 return file; /* Loaded OK! */
51 return NULL; /* Not a valid font file */
54 *** ../vim-7.2.035/src/gui_w48.c Thu Jul 24 20:50:23 2008
55 --- src/gui_w48.c Wed Nov 12 11:37:41 2008
60 * Convert the string s to the proper format for a filter string by replacing
61 ! * the \t and \n delimeters with \0.
62 * Returns the converted string in allocated memory.
64 * Keep in sync with convert_filterW() above!
68 * Convert the string s to the proper format for a filter string by replacing
69 ! * the \t and \n delimiters with \0.
70 * Returns the converted string in allocated memory.
72 * Keep in sync with convert_filterW() above!
75 * Use "prog" as the name of the program and "cmdline" as the arguments.
76 * Copy the arguments to allocated memory.
77 * Return the number of arguments (including program name).
78 ! * Return pointers to the arguments in "argvp".
79 * Return pointer to buffer in "tofree".
80 * Returns zero when out of memory.
83 * Use "prog" as the name of the program and "cmdline" as the arguments.
84 * Copy the arguments to allocated memory.
85 * Return the number of arguments (including program name).
86 ! * Return pointers to the arguments in "argvp". Memory is allocated with
87 ! * malloc(), use free() instead of vim_free().
88 * Return pointer to buffer in "tofree".
89 * Returns zero when out of memory.
100 /* Try using the Unicode version first, it takes care of conversion when
101 * 'encoding' is changed. */
104 argv = (char **)malloc((argc + 1) * sizeof(char *));
107 ! vim_free(newcmdline);
108 return 0; /* malloc error */
116 argv[argc] = NULL; /* NULL-terminated list */
120 argv = (char **)malloc((argc + 1) * sizeof(char *));
124 return 0; /* malloc error */
127 + *tofree = newcmdline;
132 argv[argc] = NULL; /* NULL-terminated list */
135 *** ../vim-7.2.035/src/os_vms.c Wed Aug 6 18:38:52 2008
136 --- src/os_vms.c Wed Nov 12 11:42:12 2008
139 else if ((sbuf = getenv((char *)lognam)))
141 lengte = strlen(sbuf) + 1;
142 ! cp = (char_u *)malloc((size_t)lengte);
144 strcpy((char *)cp, sbuf);
147 else if ((sbuf = getenv((char *)lognam)))
149 lengte = strlen(sbuf) + 1;
150 ! cp = (char_u *)alloc((size_t)lengte);
152 strcpy((char *)cp, sbuf);
156 if (--vms_match_free == 0) {
157 /* add more space to store matches */
158 vms_match_alloced += EXPL_ALLOC_INC;
159 ! vms_fmatch = (char_u **)realloc(vms_fmatch,
160 sizeof(char **) * vms_match_alloced);
164 if (--vms_match_free == 0) {
165 /* add more space to store matches */
166 vms_match_alloced += EXPL_ALLOC_INC;
167 ! vms_fmatch = (char_u **)vim_realloc(vms_fmatch,
168 sizeof(char **) * vms_match_alloced);
173 if (--files_free < 1)
175 files_alloced += EXPL_ALLOC_INC;
176 ! *file = (char_u **)realloc(*file,
177 sizeof(char_u **) * files_alloced);
181 if (--files_free < 1)
183 files_alloced += EXPL_ALLOC_INC;
184 ! *file = (char_u **)vim_realloc(*file,
185 sizeof(char_u **) * files_alloced);
193 ! buf = (char *)realloc(buf, buflen);
195 ! buf = (char *)calloc(buflen, sizeof(char));
200 ! tmpbuf = (char *)calloc(buflen, sizeof(char));
201 strcpy(tmpbuf, instring);
208 ! buf = (char *)vim_realloc(buf, buflen);
210 ! buf = (char *)alloc(buflen * sizeof(char));
215 ! tmpbuf = (char *)alloc(buflen * sizeof(char));
216 strcpy(tmpbuf, instring);
219 *** ../vim-7.2.035/src/os_w32exe.c Fri Jul 1 00:06:20 2005
220 --- src/os_w32exe.c Wed Nov 12 11:45:43 2008
234 ! if (tofree != NULL)
239 *** ../vim-7.2.035/src/os_win16.c Wed Jun 25 00:49:34 2008
240 --- src/os_win16.c Wed Nov 12 11:45:53 2008
254 ! if (tofree != NULL)
259 *** ../vim-7.2.035/src/version.c Wed Nov 12 13:07:48 2008
260 --- src/version.c Wed Nov 12 13:28:51 2008
264 { /* Add new patch number below this line */
270 hundred-and-one symptoms of being an internet addict:
271 239. You think "surfing" is something you do on dry land.
273 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
274 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
275 \\\ download, build and distribute -- http://www.A-A-P.org ///
276 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///