Thread (15 messages) flat view 15 messages, 3 authors, 2020-08-19

Re: [PATCH 1/3] dir: fix leak of parent_hashmap and recursive_hashmap

From: Elijah Newren <hidden>
Date: 2020-08-17 17:31:21

On Sun, Aug 16, 2020 at 1:43 AM Jeff King [off-list ref] wrote:
On Sun, Aug 16, 2020 at 06:59:09AM +0000, Elijah Newren via GitGitGadget wrote:
quoted
From: Elijah Newren <redacted>

Commit 96cc8ab531 ("sparse-checkout: use hashmaps for cone patterns",
2019-11-21) added a parent_hashmap and recursive_hashmap to each struct
pattern_list and initialized these in add_patterns_from_buffer() but did
not make sure to add necessary code to clear_pattern_list() to free
these new structures.  Call hashmap_free_() on each to plug this memory
leak.
Beat you to it. :)

See: https://lore.kernel.org/git/20200814111049.GA4101811@coredump.intra.peff.net/ (local)
Doh!  However, you do need to take care to free the hash table in
addition to the hash entries, or you'll still have a leak (I actually
made the same mistake)...  I'll add those comments on your patch,
though.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help