mirror of https://github.com/python/cpython
bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)
This commit is contained in:
parent
675d17cec4
commit
60bd1f88f2
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue