]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/annotate: fix leaking args vector
authorPatrick Steinhardt <ps@pks.im>
Mon, 30 Sep 2024 09:13:10 +0000 (11:13 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Sep 2024 18:23:02 +0000 (11:23 -0700)
commit9a48fc1da277f37b602f48e8bec22f4725ebf877
tree807f4459b7a7588952096beaff73adb573286997
parenta5031223cda0f37f70b901f7a2b7cd78e0627d82
builtin/annotate: fix leaking args vector

We're leaking the args vector in git-annotate(1) because we never clear
it. Fixing it isn't as easy as calling `strvec_clear()` though because
calling `cmd_blame()` will cause the underlying array to be modified.
Instead, we also need to pass a shallow copy of the argv array to the
function.

Do so to plug the memory leaks.

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