Re: [PATCH 01/13] load_one_loose_object_map(): fix resource leak
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jul 4, 2026, 08:58 UTC
- Message-ID
- <9dd7e482-5a4d-b75d-56a4-2c422cbd8812@gmx.de>
- In-Reply-To
- <xmqqcxx6pths.fsf@gitster.g>
Hi Junio,
On Wed, 1 Jul 2026, Junio C Hamano wrote:
Show 10 quoted lines
> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> > writes: > > > + ret = 0; > > Or we can do > > ret = ferror(fp) ? -1 : 0; > > if we want to be sure that we have caught all the errors.
Agreed; that is what v2 will use.
To corroborate the diagnosis: `strbuf_getline_lf()` ultimately calls `getdelim()`, which returns -1 on both EOF and I/O error, so `ferror(fp)` on the underlying stream is the only reliable way to distinguish the two. That also makes the `errno = 0;` I had added at the top of the loop dead, so it goes away in v2.
Ciao, Johannes