]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/rebase: do not assign default backend to non-constant field
authorPatrick Steinhardt <ps@pks.im>
Fri, 7 Jun 2024 06:39:26 +0000 (08:39 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 7 Jun 2024 17:30:55 +0000 (10:30 -0700)
commit25a47ffac0c50d3bae4058e6327c7bd799240df9
tree7363e0d3729d26e2e8b701470781c803328d2151
parent6d1f198f346fb218e06e730bac28609aa402a648
builtin/rebase: do not assign default backend to non-constant field

The `struct rebase_options::default_backend` field is a non-constant
string, but is being assigned a constant via `REBASE_OPTIONS_INIT`.
Fix this by using `xstrdup()` to assign the variable and introduce a new
function `rebase_options_release()` that releases memory held by the
structure, including the newly-allocated variable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rebase.c