Message ID | 19eb9073482144d0983de1ff9529fe050b3fc6a0.1724656120.git.ps@pks.im (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Memory leak fixes (pt.6) | expand |
Patrick Steinhardt <ps@pks.im> writes: > 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> > --- > builtin/repack.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/builtin/repack.c b/builtin/repack.c > index 8bb875532b4..a382754feee 100644 > --- a/builtin/repack.c > +++ b/builtin/repack.c > @@ -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); > } Obviously correct. Thanks.
diff --git a/builtin/repack.c b/builtin/repack.c index 8bb875532b4..a382754feee 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -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 {
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> --- builtin/repack.c | 2 ++ 1 file changed, 2 insertions(+)