[Python-checkins] cpython (3.3): Check return value of PyEval_GetGlobals() for NULL

christian.heimes python-checkins at python.org
Sat Jul 20 22:55:05 CEST 2013


http://hg.python.org/cpython/rev/8b8673ccd3d1
changeset:   84745:8b8673ccd3d1
branch:      3.3
parent:      84743:366eebaad633
user:        Christian Heimes <christian at cheimes.de>
date:        Sat Jul 20 22:54:25 2013 +0200
summary:
  Check return value of PyEval_GetGlobals() for NULL
CID 486814

files:
  Modules/pyexpat.c |  9 +++++++--
  1 files changed, 7 insertions(+), 2 deletions(-)


diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -283,12 +283,17 @@
 {
     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;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list