]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/worktree: fix leaking derived branch names
authorPatrick Steinhardt <ps@pks.im>
Thu, 1 Aug 2024 10:40:46 +0000 (12:40 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Aug 2024 15:47:37 +0000 (08:47 -0700)
commitcd6d7630fa51ad16afa010c6619870cab6c6faba
treef60e1a462b3758bd696609a2f0ffe4cf454be3b4
parent06da42beec11e056f43425b2be623fefc0427670
builtin/worktree: fix leaking derived branch names

There are several heuristics that git-worktree(1) uses to derive the
name of the newly created branch when not given explicitly. These
heuristics all allocate a new string, but we only end up freeing that
string in a subset of cases.

Fix the remaining cases where we didn't yet free the derived branch
names. While at it, also free `opt_track`, which is being populated via
an `OPT_PASSTHRU()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c
t/t2400-worktree-add.sh
t/t9902-completion.sh