]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/pull: fix leaking "ff" option
authorPatrick Steinhardt <ps@pks.im>
Thu, 26 Sep 2024 11:46:26 +0000 (13:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Sep 2024 15:25:35 +0000 (08:25 -0700)
commit49af1b772222673759756048344b142544d39849
tree7ac733b9d10f85969947a8b49b6d16fd9249b073
parent04ff8008f3a27274e53c69209362a5bbe3dc4457
builtin/pull: fix leaking "ff" option

The `opt_ff` field gets populated either via `OPT_PASSTHRU` via
`config_get_ff()` or when `--rebase` is passed. So we sometimes end up
overriding the value in `opt_ff` with another value, but we do not free
the old value, causing a memory leak.

Adapt the type of the variable to be `char *` and consistently assign
allocated strings to it such that we can easily free it when it is being
overridden.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pull.c
t/t7601-merge-pull-config.sh