]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
closes bpo-34477: Objects/typeobject.c: Add missing NULL check to type_init() (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 24 Aug 2018 04:51:46 +0000 (00:51 -0400)
committerGitHub <noreply@github.com>
Fri, 24 Aug 2018 04:51:46 +0000 (00:51 -0400)
Reported by Svace static analyzer.
(cherry picked from commit f6247aac08c1a79d0479145a405718bb76dba434)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
Objects/typeobject.c

index 685c5457737f8cde430803dcbc8e250661d518d0..d576b8250d017df528fcb32091ae294b816543bb 100644 (file)
@@ -2082,6 +2082,9 @@ type_init(PyObject *cls, PyObject *args, PyObject *kwds)
     /* Call object.__init__(self) now. */
     /* XXX Could call super(type, cls).__init__() but what's the point? */
     args = PyTuple_GetSlice(args, 0, 0);
+    if (args == NULL) {
+        return -1;
+    }
     res = object_init(cls, args, NULL);
     Py_DECREF(args);
     return res;