]> granicus.if.org Git - python/commitdiff
bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)
authorZackery Spytz <zspytz@gmail.com>
Wed, 4 Sep 2019 13:58:05 +0000 (07:58 -0600)
committerVictor Stinner <vstinner@redhat.com>
Wed, 4 Sep 2019 13:58:04 +0000 (15:58 +0200)
Objects/tupleobject.c

index 3419baa529a6f031f0ceffbfaa60eda431a7382f..a72257f95b083be4e9f5d4246a32a3ef4a0e6028 100644 (file)
@@ -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;
     }