On Tue, Aug 13, 2024 at 09:34:40AM -0700, Junio C Hamano wrote: > Patrick Steinhardt <ps@xxxxxx> writes: > > > Before calling `handle_commit()` in a loop, we set `diffopt.no_free` > > such that its contents aren't getting freed inside of `handle_commit()`. > > We never unset that flag though, which means that it'll ultimately leak > > when calling `release_revisions()`. > > > > Fix this by unsetting the flag after the loop. > > If I grep for > > $ git grep -nH -E -e '(\.|->)no_free' \*.c > > I notice that in a lot of places there is a pattern of doing > > set .no_free to 1 > cause a bunch of diff using the same set of options > set .no_free to 0 > call diff_free(). > > I am curious why we do not need any diff_free() here? Because it's already being called via `release_revisions()`. Patrick