From a6404ad43c11d04909a9e01f85559e1b52e616b4 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sat, 20 Jul 2013 22:54:25 +0200 Subject: [PATCH] Check return value of PyEval_GetGlobals() for NULL CID 486814 --- Modules/pyexpat.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 07b1348d378..7e51d35e622 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -283,12 +283,17 @@ call_with_frame(PyCodeObject *c, PyObject* func, PyObject* args, { PyThreadState *tstate = PyThreadState_GET(); PyFrameObject *f; - PyObject *res; + PyObject *res, *globals; if (c == NULL) return NULL; - f = PyFrame_New(tstate, c, PyEval_GetGlobals(), NULL); + globals = PyEval_GetGlobals(); + if (globals == NULL) { + return NULL; + } + + f = PyFrame_New(tstate, c, globals, NULL); if (f == NULL) return NULL; tstate->frame = f;