8000 Fix a possible refleak in tupleobject.c (GH-19018) · python/cpython@890dcfe · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 890dcfe

Browse files
Fix a possible refleak in tupleobject.c (GH-19018)
(cherry picked from commit c81609e) Co-authored-by: Hai Shi <shihai1992@gmail.com>
1 parent f7e32fc commit 890dcfe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Objects/tupleobject.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,10 @@ tuple_subtype_new(PyTypeObject *type, PyObject *iterable)
719719
return NULL;
720720
assert(PyTuple_Check(tmp));
721721
newobj = type->tp_alloc(type, n = PyTuple_GET_SIZE(tmp));
722-
if (newobj == NULL)
722+
if (newobj == NULL) {
723+
Py_DECREF(tmp);
723724
return NULL;
725+
}
724726
for (i = 0; i < n; i++) {
725727
item = PyTuple_GET_ITEM(tmp, i);
726728
Py_INCREF(item);

0 commit comments

Comments
 (0)
0