aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--builtin/pull.c11
-rwxr-xr-xt/t7601-merge-pull-config.sh1
2 files changed, 8 insertions, 4 deletions
diff --git a/builtin/pull.c b/builtin/pull.c
index 4c54d8196f..5d9d9e467e 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -84,7 +84,7 @@ static const char *opt_squash;
static const char *opt_commit;
static const char *opt_edit;
static const char *cleanup_arg;
-static const char *opt_ff;
+static char *opt_ff;
static const char *opt_verify_signatures;
static const char *opt_verify;
static int opt_autostash = -1;
@@ -1024,8 +1024,10 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
* "--rebase" can override a config setting of
* pull.ff=only.
*/
- if (opt_rebase >= 0 && opt_ff && !strcmp(opt_ff, "--ff-only"))
- opt_ff = "--ff";
+ if (opt_rebase >= 0 && opt_ff && !strcmp(opt_ff, "--ff-only")) {
+ free(opt_ff);
+ opt_ff = xstrdup("--ff");
+ }
}
if (opt_rebase < 0)
@@ -1135,7 +1137,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
if (can_ff) {
/* we can fast-forward this without invoking rebase */
- opt_ff = "--ff-only";
+ free(opt_ff);
+ opt_ff = xstrdup("--ff-only");
ret = run_merge();
} else {
ret = run_rebase(&newbase, &upstream);
diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh
index a94387a75f..7fd8c086af 100755
--- a/t/t7601-merge-pull-config.sh
+++ b/t/t7601-merge-pull-config.sh
@@ -4,6 +4,7 @@ test_description='git merge
Testing pull.* configuration parsing and other things.'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '