Skip to content

Commit 60bd1f8

Browse files
ZackerySpytzvstinner
authored andcommitted
bpo-36030: Fix a possible segfault in PyTuple_New() (pythonGH-15670)
1 parent 675d17c commit 60bd1f8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Objects/tupleobject.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ PyTuple_New(Py_ssize_t size)
146146
}
147147
#endif
148148
op = tuple_alloc(size);
149+
if (op == NULL) {
150+
return NULL;
151+
}
149152
for (Py_ssize_t i = 0; i < size; i++) {
150153
op->ob_item[i] = NULL;
151154
}

0 commit comments

Comments
 (0)