Skip to content

Commit

Permalink
use xstrdup, not strdup in ll-merge.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jim Meyering authored and Junio C Hamano committed Jun 14, 2009
1 parent c97038d commit 90dce51
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ll-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static int read_merge_config(const char *var, const char *value, void *cb)

if (!strcmp(var, "merge.default")) {
if (value)
default_ll_merge = strdup(value);
default_ll_merge = xstrdup(value);
return 0;
}

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

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

if (!strcmp("recursive", ep)) {
if (!value)
return error("%s: lacks value", var);
fn->recursive = strdup(value);
fn->recursive = xstrdup(value);
return 0;
}

Expand Down

0 comments on commit 90dce51

Please sign in to comment.