mirror of
https://github.com/python/cpython.git
synced 2026-06-18 15:42:21 +00:00
[3.13] gh-150178: Fix refcount leaks in hamt allocation failure paths (GH-150179) (#150301)
gh-150178: Fix refcount leaks in hamt allocation failure paths (GH-150179)
(cherry picked from commit 32823af153)
Co-authored-by: pengyu lee <lipengyu@kylinos.cn>
This commit is contained in:
parent
7388a67340
commit
95c93239be
1 changed files with 2 additions and 0 deletions
|
|
@ -718,6 +718,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);
|
||||
|
|
@ -1010,6 +1011,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