https://github.com/python/cpython/commit/32823af153b76b7042fbce28ea8a6e0c3c4f1ca8
commit: 32823af153b76b7042fbce28ea8a6e0c3c4f1ca8
branch: main
author: pengyu lee <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-05-23T14:03:40+05:30
summary:
gh-150178: Fix refcount leaks in hamt allocation failure paths (#150179)
files:
M Python/hamt.c
diff --git a/Python/hamt.c b/Python/hamt.c
index e4719e71a5259a5..95998ae5062ac7e 100644
--- a/Python/hamt.c
+++ b/Python/hamt.c
@@ -702,6 +702,7 @@ hamt_node_bitmap_assoc(PyHamtNode_Bitmap *self,
PyHamtNode_Bitmap *ret = hamt_node_bitmap_clone(self);
if (ret == NULL) {
+ Py_DECREF(sub_node);
return NULL;
}
Py_SETREF(ret->b_array[val_idx], (PyObject*)sub_node);
@@ -994,6 +995,7 @@ hamt_node_bitmap_without(PyHamtNode_Bitmap *self,
PyHamtNode_Bitmap *clone = hamt_node_bitmap_clone(self);
if (clone == NULL) {
+ Py_DECREF(sub_node);
return W_ERROR;
}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]