From 3f8464917673e1cb27bcf33966a6be994340760e Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Tue, 3 Sep 2019 16:35:48 -0600 Subject: [PATCH] bpo-36030: Fix a possible segfault in PyTuple_New() --- 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; }