read-cache: fix leaking hash context in `do_write_index()`

When writing an index with the EOIE extension we allocate a separate hash context. We never free that context though, causing a memory leak. Plug it. This leak is exposed by t9210, but plugging it alone does not make the whole test suite pass. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Sep 30, 2024 at 11:13 UTC a69d120c077ce4e3f6164e23d41147370a0d687a
1 file changed +1
read-cache.c
+1
@@ -3124,6 +3124,7 @@ out:
3124 if (f)
3125 free_hashfile(f);
3126 strbuf_release(&sb);
3127 + free(eoie_c);
3128 free(ieot);
3129 return ret;
3130 }