]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/repack: fix leaking line buffer when packing promisors
authorPatrick Steinhardt <ps@pks.im>
Thu, 5 Sep 2024 10:09:23 +0000 (12:09 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Sep 2024 15:49:12 +0000 (08:49 -0700)
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>
builtin/repack.c

index 62cfa50c50f893406803cbbedef711f35167cb14..2b9bf0318ad5ed7a62b38722da783394dd83963a 100644 (file)
@@ -425,9 +425,11 @@ static void repack_promisor_objects(const struct pack_objects_args *args,
 
                free(promisor_name);
        }
+
        fclose(out);
        if (finish_command(&cmd))
                die(_("could not finish pack-objects to repack promisor objects"));
+       strbuf_release(&line);
 }
 
 struct pack_geometry {