builtin/repack: fix leaking line buffer when packing promisors
In `repack_promisor_objects()` we read output from git-pack-objects(1) line by line, using `strbuf_getline_lf()`. We never free the line buffer, causing a memory leak. Plug it. This leak is being hit in t5616, but plugging it alone is not sufficient to make the whole test suite leak free. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Sep 5, 2024 at 12:09 UTC
860b6780163ade3bb705d6565619ec13efcc77c6
1 file changed
+2
builtin/repack.c
+2
@@ -425,9 +425,11 @@ static void repack_promisor_objects(const struct pack_objects_args *args,
425
426
free(promisor_name);
427
}
428
+
429
fclose(out);
430
if (finish_command(&cmd))
431
die(_("could not finish pack-objects to repack promisor objects"));
432
+ strbuf_release(&line);
433
}
434
435
struct pack_geometry {