summaryrefslogtreecommitdiff
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-08-24 00:38:16 -0400
committerGitHub <noreply@github.com>2018-08-24 00:38:16 -0400
commit609062a23f018f4ffc180a88435d61f871165518 (patch)
treee64af0ff95277af57b18f94ae89406044cc80b9b /Objects/typeobject.c
parent1d3d688b9899085473c455dbfdb6acdaa6ee7b99 (diff)
downloadcpython-git-609062a23f018f4ffc180a88435d61f871165518.tar.gz
closes bpo-34477: Objects/typeobject.c: Add missing NULL check to type_init() (GH-8876)
Reported by Svace static analyzer. (cherry picked from commit f6247aac08c1a79d0479145a405718bb76dba434) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index a7a9d7bf9f..af9685d17d 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2295,6 +2295,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;