]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/submodule--helper: fix leaking buffer in `is_tip_reachable`
authorPatrick Steinhardt <ps@pks.im>
Thu, 1 Aug 2024 10:39:57 +0000 (12:39 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Aug 2024 15:47:35 +0000 (08:47 -0700)
commit6771e2012e15ed3748997566640c34b492c2cf67
tree5183776ac388eeb51b6d7eab2963d22e9457d571
parent5535b3f3d3eaafa872514af05f021ae6d00f83dc
builtin/submodule--helper: fix leaking buffer in `is_tip_reachable`

The `rev` buffer in `is_tip_reachable()` is being populated with the
output of git-rev-list(1) -- if either the command fails or the buffer
contains any data, then the input commit is not reachable.

The buffer isn't used for anything else, but neither do we free it,
causing a memory leak. Fix this.

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