git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] bundle-uri: plug leak in unbundle_from_file()

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 10, 2024, 18:47 UTC
Message-ID
<xmqq8quvlrqa.fsf@gitster.g>
In-Reply-To
<ZwfOsoC35x-wyn7S@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 22 quoted lines
> On Thu, Oct 10, 2024 at 11:12:49AM +0200, Toon Claes wrote:
>> The function `unbundle_from_file()` has two memory leaks:
>> 
>>   - We do not release the `struct bundle_header header` when hitting
>>     errors because we return early without any cleanup.
>> 
>>   - We do not release the `struct strbuf bundle_ref` at all.
>> 
>> Plug these leaks by creating a common exit path where both of these
>> variables are released.
>> 
>> While at it, refactor the code such that the variable assignments do not
>> happen inside the conditional statement itself according to our coding
>> style.
>
> Thanks, this version looks good to me. We now avoid any discussion
> around the changed error code completely, and the commit message seems
> reasonable to me.
>
> Thanks!
>
> Patrick
Thanks, both of you.
Will queue.
Previous: Patrick Steinhardt
Message 9 of 9 in “bundle-uri: plug leak in unbundle_from_file()”
  1. bundle-uri: plug leak in unbundle_from_file()Toon Claes, Aug 26, 2024
  2. Patrick SteinhardtAug 26, 2024
  3. Junio C HamanoAug 26, 2024
  4. Toon ClaesOct 1, 2024
  5. Junio C HamanoOct 1, 2024
  6. Toon ClaesOct 10, 2024
  7. bundle-uri: plug leak in unbundle_from_file()Toon Claes, Oct 10, 2024
  8. Patrick SteinhardtOct 10, 2024
  9. Junio C HamanoOct 10, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.