diff mbox series

[v4] fixup! hook: run a list of hooks instead

Message ID patch-1.1-38b21b65bee-20210909T125613Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v4] fixup! hook: run a list of hooks instead | expand

Commit Message

Ævar Arnfjörð Bjarmason Sept. 9, 2021, 12:59 p.m. UTC
---

And of course just as I sent out
<cover-v4-0.5-00000000000-20210909T122802Z-avarab@gmail.com> I noticed
that there was one last memory leak left, it just wasn't stressed by
t1800-hook.sh, but some of the test of the tests, including
t0000-basic.sh!

That test coverage should be improved, but in the meantime Junio:
Here's a fixup to the just-sent you can hopefully squash into the
1/5. Sorry about the screwup.

 hook.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/hook.c b/hook.c
index dc3033cb4c7..4b4205bce6c 100644
--- a/hook.c
+++ b/hook.c
@@ -416,8 +416,10 @@  int run_hooks_oneshot(const char *hook_name, struct run_hooks_opt *options)
 	 * If you need to act on a missing hook, use run_found_hooks()
 	 * instead
 	 */
-	if (list_empty(hooks))
+	if (list_empty(hooks)) {
+		clear_hook_list(hooks);
 		goto cleanup;
+	}
 
 	ret = run_hooks(hook_name, hooks, options);