]> granicus.if.org Git - python/commitdiff
Check return value of PyEval_GetGlobals() for NULL
authorChristian Heimes <christian@cheimes.de>
Sat, 20 Jul 2013 20:54:25 +0000 (22:54 +0200)
committerChristian Heimes <christian@cheimes.de>
Sat, 20 Jul 2013 20:54:25 +0000 (22:54 +0200)
CID 486814

Modules/pyexpat.c

index 07b1348d37803544768289b0be4ca895fc0676c5..7e51d35e622006b46cd4940e5751016d8dc9b166 100644 (file)
@@ -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;