Commit 60bd1f88 authored by Zackery Spytz's avatar Zackery Spytz Committed by Victor Stinner

bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)

parent 675d17ce
...@@ -146,6 +146,9 @@ PyTuple_New(Py_ssize_t size) ...@@ -146,6 +146,9 @@ PyTuple_New(Py_ssize_t size)
} }
#endif #endif
op = tuple_alloc(size); op = tuple_alloc(size);
if (op == NULL) {
return NULL;
}
for (Py_ssize_t i = 0; i < size; i++) { for (Py_ssize_t i = 0; i < size; i++) {
op->ob_item[i] = NULL; op->ob_item[i] = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment