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?