]> git.ipfire.org Git - thirdparty/git.git/commit
submodule: fix leaking fetch tasks
authorPatrick Steinhardt <ps@pks.im>
Thu, 8 Aug 2024 07:35:51 +0000 (09:35 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Aug 2024 16:22:21 +0000 (09:22 -0700)
commit1a7e5efdb06a7e3087bf9068220b011f006db43f
treec7967a04fc9219ce2c4e0b1a57ee16262b99a01e
parentc369fc46d079447d216f7ef309ff60abe493cdb6
submodule: fix leaking fetch tasks

When done with a fetch task used for parallel fetches of submodules, we
need to both call `fetch_task_release()` to release the task's contents
and `free()` to release the task itself. Most sites do this already, but
some only call `fetch_task_release()` and thus leak memory.

While we could trivially fix this by adding the two missing calls to
free(3P), the result would be that we always call both functions. Let's
thus refactor the code such that `fetch_task_release()` also frees the
structure itself. Rename it to `fetch_task_free()` accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
submodule.c