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

Re: [PATCH] delta-islands: free island_marks and bitmaps

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 2, 2023, 01:45 UTC
Message-ID
<230202.86mt5wq1i7.gmgdl@evledraar.gmail.com>
In-Reply-To
<20230202010353.23391-1-e@80x24.org>
On Thu, Feb 02 2023, Eric Wong wrote:
> +	kh_foreach_value(island_marks, bitmap, {
> +		if (--bitmap->refcount == 0)
Style nit: if (!--x) rather than if (--x == 0) ?
> +			free(bitmap);
> +	});
> +	kh_destroy_oid_map(island_marks);
> +	island_marks = (void *)1; /* crash on unintended future use */

This seems counter-productive. If you just leave it free'd then various analysis tools will spot a use-after-free earlier, won't they?

Previous: Eric WongNext: Eric Wong
Message 2 of 6 in “delta-islands: free island_marks and bitmaps”
  1. delta-islands: free island_marks and bitmapsEric Wong, Feb 2, 2023
  2. Ævar Arnfjörð BjarmasonFeb 2, 2023
  3. delta-islands: free island_marks and bitmapsEric Wong, Feb 2, 2023
  4. Jeff KingFeb 3, 2023
  5. delta-islands: free island_marks and bitmapsEric Wong, Feb 3, 2023
  6. Jeff KingFeb 4, 2023

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.