On Mon, Apr 22, 2024 at 04:41:18PM +0100, Phillip Wood wrote: > On 21/04/2024 11:28, Rubén Justo wrote: > > Plug a leak we have since cfb6f9acc3 (apply: accept -3/--3way command > > line option, 2012-05-08). > > Looking at that commit I see > > - if (apply_fragments(&image, patch) < 0) > - return -1; /* note with --reject this succeeds. */ > + if (apply_fragments(&image, patch) < 0) { > + /* Note: with --reject, apply_fragments() returns 0 */ > + if (!threeway || try_threeway(&image, patch, st, ce) < 0) > + return -1; > + } > > So the leak existed before that commit. Indeed it looks > like the leak predates the introduction of struct image in b94f2eda99 > (builtin-apply.c: make it more line oriented, 2008-01-26) and when > the patch does not apply we have been leaking the buffer passed to > apply_fragments() since the beginning of the builtin apply added in > ac6245e31a3 (Builtin git-apply., 2006-05-23) You are very right. I saw that commit. I reviewed again my notes and I recorded the hash of the previous hop; the one that my message, incorrectly, refers to. I'll reroll to fix it. Thank you very much for your attention.