Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a6404ad

Browse files
committed
Check return value of PyEval_GetGlobals() for NULL
CID 486814
1 parent 09994a9 commit a6404ad

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Modules/pyexpat.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,17 @@ call_with_frame(PyCodeObject *c, PyObject* func, PyObject* args,
283283
{
284284
PyThreadState *tstate = PyThreadState_GET();
285285
PyFrameObject *f;
286-
PyObject *res;
286+
PyObject *res, *globals;
287287

288288
if (c == NULL)
289289
return NULL;
290290

291-
f = PyFrame_New(tstate, c, PyEval_GetGlobals(), NULL);
291+
globals = PyEval_GetGlobals();
292+
if (globals == NULL) {
293+
return NULL;
294+
}
295+
296+
f = PyFrame_New(tstate, c, globals, NULL);
292297
if (f == NULL)
293298
return NULL;
294299
tstate->frame = f;

0 commit comments

Comments
 (0)