Skip to content

Commit 6a015ce

Browse files
committed
Merge branch 'kg/external-diff-save-env'
The code to drive GIT_EXTERNAL_DIFF command relied on the string returned from getenv() to be non-volatile, which is not true, that has been corrected. * kg/external-diff-save-env: diff: ensure correct lifetime of external_diff_cmd
2 parents 16a465b + 6776a84 commit 6a015ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ static const char *external_diff(void)
493493

494494
if (done_preparing)
495495
return external_diff_cmd;
496-
external_diff_cmd = getenv("GIT_EXTERNAL_DIFF");
496+
external_diff_cmd = xstrdup_or_null(getenv("GIT_EXTERNAL_DIFF"));
497497
if (!external_diff_cmd)
498498
external_diff_cmd = external_diff_cmd_cfg;
499499
done_preparing = 1;

0 commit comments

Comments
 (0)