Skip to content

Commit 90dce51

Browse files
meyeringgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c97038d commit 90dce51

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ll-merge.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static int read_merge_config(const char *var, const char *value, void *cb)
233233

234234
if (!strcmp(var, "merge.default")) {
235235
if (value)
236-
default_ll_merge = strdup(value);
236+
default_ll_merge = xstrdup(value);
237237
return 0;
238238
}
239239

@@ -267,7 +267,7 @@ static int read_merge_config(const char *var, const char *value, void *cb)
267267
if (!strcmp("name", ep)) {
268268
if (!value)
269269
return error("%s: lacks value", var);
270-
fn->description = strdup(value);
270+
fn->description = xstrdup(value);
271271
return 0;
272272
}
273273

@@ -290,14 +290,14 @@ static int read_merge_config(const char *var, const char *value, void *cb)
290290
* file named by %A, and signal that it has done with zero exit
291291
* status.
292292
*/
293-
fn->cmdline = strdup(value);
293+
fn->cmdline = xstrdup(value);
294294
return 0;
295295
}
296296

297297
if (!strcmp("recursive", ep)) {
298298
if (!value)
299299
return error("%s: lacks value", var);
300-
fn->recursive = strdup(value);
300+
fn->recursive = xstrdup(value);
301301
return 0;
302302
}
303303

0 commit comments

Comments
 (0)