summaryrefslogtreecommitdiff
path: root/Objects/tupleobject.c
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-09-04 07:58:05 -0600
committerVictor Stinner <vstinner@redhat.com>2019-09-04 15:58:04 +0200
commit60bd1f88f21073965a444c8b39c4202d015da5d6 (patch)
tree2752030cc7c37535139644e4722d5b56418cd4fd /Objects/tupleobject.c
parent675d17cec49ed7f7eb01d1bc3ae6999c728e070d (diff)
downloadcpython-git-60bd1f88f21073965a444c8b39c4202d015da5d6.tar.gz
bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r--Objects/tupleobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 3419baa529..a72257f95b 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -146,6 +146,9 @@ PyTuple_New(Py_ssize_t size)
}
#endif
op = tuple_alloc(size);
+ if (op == NULL) {
+ return NULL;
+ }
for (Py_ssize_t i = 0; i < size; i++) {
op->ob_item[i] = NULL;
}