@matheusbsbs / matheus-bagliano / commits / 90dce51584
Fork 0

use xstrdup, not strdup in ll-merge.c

Otherwise, a fluky allocation failure would cause merge configuration settings to be silently ignored. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jim Meyering committed Jun 14, 2009 at 21:47 UTC 90dce51584e908232ff279a6c2949ea9855dddf3
1 file changed +4 -4
ll-merge.c
+4 -4
@@ -233,7 +233,7 @@ static int read_merge_config(const char *var, const char *value, void *cb)
233
234 if (!strcmp(var, "merge.default")) {
235 if (value)
236 - default_ll_merge = strdup(value);
236 + default_ll_merge = xstrdup(value);
237 return 0;
238 }
239
@@ -267,7 +267,7 @@ static int read_merge_config(const char *var, const char *value, void *cb)
267 if (!strcmp("name", ep)) {
268 if (!value)
269 return error("%s: lacks value", var);
270 - fn->description = strdup(value);
270 + fn->description = xstrdup(value);
271 return 0;
272 }
273
@@ -290,14 +290,14 @@ static int read_merge_config(const char *var, const char *value, void *cb)
290 * file named by %A, and signal that it has done with zero exit
291 * status.
292 */
293 - fn->cmdline = strdup(value);
293 + fn->cmdline = xstrdup(value);
294 return 0;
295 }
296
297 if (!strcmp("recursive", ep)) {
298 if (!value)
299 return error("%s: lacks value", var);
300 - fn->recursive = strdup(value);
300 + fn->recursive = xstrdup(value);
301 return 0;
302 }
303