Skip to content

Instantly share code, notes, and snippets.

@devdanzin
Created March 18, 2026 10:06
Show Gist options
  • Select an option

  • Save devdanzin/332a120e4c7750e8a7aff47419311696 to your computer and use it in GitHub Desktop.

Select an option

Save devdanzin/332a120e4c7750e8a7aff47419311696 to your computer and use it in GitHub Desktop.
hamt.c: sub_node leaked in bitmap_assoc and bitmap_without

hamt.c: sub_node leaked in bitmap_assoc and bitmap_without

Summary

Two analogous bugs:

  1. hamt_node_bitmap_assoc (line 704): Recursive hamt_node_assoc returns new sub_node, then hamt_node_bitmap_clone fails → sub_node leaked. Line 755 correctly DECREFs.
  2. hamt_node_bitmap_without (line 997): Same pattern. Line 968 correctly DECREFs.

Fix

Add Py_DECREF(sub_node) before return NULL/return W_ERROR at lines 705 and 997.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment