Skip to content

Commit 860b678

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a46f231 commit 860b678

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin/repack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,11 @@ static void repack_promisor_objects(const struct pack_objects_args *args,
425425

426426
free(promisor_name);
427427
}
428+
428429
fclose(out);
429430
if (finish_command(&cmd))
430431
die(_("could not finish pack-objects to repack promisor objects"));
432+
strbuf_release(&line);
431433
}
432434

433435
struct pack_geometry {

0 commit comments

Comments
 (0)