From 60bd1f88f21073965a444c8b39c4202d015da5d6 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Wed, 4 Sep 2019 07:58:05 -0600 Subject: [PATCH] bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670) --- Objects/tupleobject.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 3419baa529a6f0..a72257f95b083b 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; }