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

Re: [PATCH] sha1_file: release fallback base's memory in unpack_entry()

From
Jeff King <peff@peff.net>
Date
Feb 25, 2017, 20:48 UTC
Message-ID
<20170225204841.hvrhbgrv42437b4r@sigill.intra.peff.net>
In-Reply-To
<fe07ed70-0b93-8b2c-59f9-967d3dc1313f@web.de>
On Sat, Feb 25, 2017 at 11:02:28AM +0100, René Scharfe wrote:
> If a pack entry that's used as a delta base is corrupt, unpack_entry()
> marks it as unusable and then searches the object again in the hope that
> it can be found in another pack or in a loose file.  The memory for this
> external base object is never released.  Free it after use.

This looks good. I wondered if there were any tricks with passing the resulting base to the delta-base cache. But I don't think so. We add to the cache right _before_ the fallback check we're looking at here. And the "base" variable does not persist to the next loop.

Arguably, one could do the fallback first and then add the result to the delta base cache, but it probably isn't worth the trouble. However we read the object via read_object() would hopefully have done so already.

-Peff
Previous: René Scharfe
Message 2 of 2 in “sha1_file: release fallback base's memory in unpack_entry()”
  1. sha1_file: release fallback base's memory in unpack_entry()René Scharfe, Feb 25, 2017
  2. Jeff KingFeb 25, 2017

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.