Message ID | c51f40c5bd0c56967e348363e784222de7884b79.1727687410.git.ps@pks.im (mailing list archive) |
---|---|
State | Accepted |
Commit | a69d120c077ce4e3f6164e23d41147370a0d687a |
Headers | show |
Series | Memory leak fixes (pt.8) | expand |
On 9/30/24 5:13 AM, Patrick Steinhardt wrote: > 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> > --- > read-cache.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/read-cache.c b/read-cache.c > index 764fdfec46..0fb5e0d372 100644 > --- a/read-cache.c > +++ b/read-cache.c > @@ -3124,6 +3124,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile, > if (f) > free_hashfile(f); > strbuf_release(&sb); > + free(eoie_c); > free(ieot); > return ret; > } Thank you for finding and fixing this! This version should be used instead of the similar patch I sent today. Thanks, -Stolee
diff --git a/read-cache.c b/read-cache.c index 764fdfec46..0fb5e0d372 100644 --- a/read-cache.c +++ b/read-cache.c @@ -3124,6 +3124,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile, if (f) free_hashfile(f); strbuf_release(&sb); + free(eoie_c); free(ieot); return ret; }
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> --- read-cache.c | 1 + 1 file changed, 1 insertion(+)