diff options
| author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2023-02-06 20:08:10 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-02-06 16:03:52 -0800 |
| commit | 94ad545d47afe2b73dad871635b92956644815f5 (patch) | |
| tree | cde06c2101fbc25659c2778ecad15d875e0f965b /builtin/rebase.c | |
| parent | a6a700a43c6f73f5abef95f97355ff8ce0523e0e (diff) | |
| download | git-94ad545d47afe2b73dad871635b92956644815f5.tar.gz | |
builtin/rebase.c: fix "options.onto_name" leak
Similar to the existing "squash_onto_name" added in [1] we need to
free() the xstrdup()'d "options.onto.name" added for "--keep-base" in
[2]..
1. 9dba809a69a (builtin rebase: support --root, 2018-09-04)
2. 414d924beb4 (rebase: teach rebase --keep-base, 2019-08-27)
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rebase.c')
| -rw-r--r-- | builtin/rebase.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c index 2ec3ae0b42..41e96f0eb5 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1039,6 +1039,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) struct string_list strategy_options = STRING_LIST_INIT_NODUP; struct object_id squash_onto; char *squash_onto_name = NULL; + char *keep_base_onto_name = NULL; int reschedule_failed_exec = -1; int allow_preemptive_ff = 1; int preserve_merges_selected = 0; @@ -1675,7 +1676,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) strbuf_addstr(&buf, options.upstream_name); strbuf_addstr(&buf, "..."); strbuf_addstr(&buf, branch_name); - options.onto_name = xstrdup(buf.buf); + options.onto_name = keep_base_onto_name = xstrdup(buf.buf); } else if (!options.onto_name) options.onto_name = options.upstream_name; if (strstr(options.onto_name, "...")) { @@ -1851,6 +1852,7 @@ cleanup: free(options.strategy); strbuf_release(&options.git_format_patch_opt); free(squash_onto_name); + free(keep_base_onto_name); string_list_clear(&strategy_options, 0); return !!ret; } |
