mirror of
https://github.com/python/cpython.git
synced 2026-06-05 01:10:53 +00:00
gh-150178: Fix refcount leaks in hamt allocation failure paths (#150179)
This commit is contained in:
parent
e7eaed5614
commit
32823af153
1 changed files with 2 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue