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

Re: [PATCH v3 1/3] Fix memory leak in apply_patch in apply.c.

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 7, 2012, 23:39 UTC
Message-ID
<7vr4x4j800.fsf@alter.siamese.dyndns.org>
In-Reply-To
<eadfc83a0d823cc04ea37bf606b57597fb632156.1331158240.git.jaredhance@gmail.com>
Jared Hance <jaredhance@gmail.com> writes:
Show 6 quoted lines
> In the while loop inside apply_patch, patch is dynamically allocated
> with a calloc. However, only unused patches are actually free'd; the
> rest are left in a memory leak. Since a list is actively built up
> consisting of the used patches, they can simply be iterated and free'd
> at the end of the function.
> ...
Thanks.

This more-or-less looks good modulo minor style issues. We might also want to make rejected a one-bit bitfield that sits next to the new free_patch field to share the same word, but that is a separate topic.

Will queue.
Previous: Jared HanceNext: Junio C Hamano
Message 3 of 9 in “Fix documented fixme's throughout”
  1. 0/3 Fix documented fixme's throughoutJared Hance, Mar 7, 2012
  2. 1/3 Fix memory leak in apply_patch in apply.c.Jared Hance, Mar 7, 2012
  3. Junio C HamanoMar 7, 2012
  4. 1/2 apply: free patch->{def,old,new}_name fieldsJunio C Hamano, Mar 21, 2012
  5. 2/2 apply: free patch->resultJunio C Hamano, Mar 21, 2012
  6. 2/3 Add threaded versions of functions in symlinks.c.Jared Hance, Mar 7, 2012
  7. Junio C HamanoMar 7, 2012
  8. 3/3 Use startup_info->prefix rather than prefix.Jared Hance, Mar 7, 2012
  9. Junio C HamanoMar 7, 2012

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.