]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/replay: plug leaking `advance_name` variable
authorPatrick Steinhardt <ps@pks.im>
Thu, 1 Aug 2024 10:38:11 +0000 (12:38 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Aug 2024 15:47:34 +0000 (08:47 -0700)
commit34968e56de472fa864641abefbaf4a4923b77507
tree47a3d4fd81db5fcbc4bd672f7b55bb844ce17544
parentad57f148c6b5f8735b62238dda8f571c582e0e54
builtin/replay: plug leaking `advance_name` variable

The `advance_name` variable can either contain a static string when
parsed via the `--advance` command line option or it may be an allocated
string when set via `determine_replay_mode()`. Because we cannot be sure
whether it is allocated or not we just didn't free it at all, resulting
in a memory leak.

Split up the variables such that we can track the static and allocated
strings separately and then free the allocated one to fix the memory
leak.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/replay.c
t/t3650-replay-basics.sh