Kaydet (Commit) ece448ef authored tarafından Neal Norwitz's avatar Neal Norwitz

Properly handle a NULL returned from PyArena_New().

Klocwork #364.  Will port to head.
üst 48829ba6
...@@ -796,14 +796,16 @@ parse_source_module(const char *pathname, FILE *fp) ...@@ -796,14 +796,16 @@ parse_source_module(const char *pathname, FILE *fp)
{ {
PyCodeObject *co = NULL; PyCodeObject *co = NULL;
mod_ty mod; mod_ty mod;
PyArena *arena = PyArena_New(); PyArena *arena = PyArena_New();
if (arena == NULL)
return NULL;
mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, 0, mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, 0,
NULL, arena); NULL, arena);
if (mod) { if (mod) {
co = PyAST_Compile(mod, pathname, NULL, arena); co = PyAST_Compile(mod, pathname, NULL, arena);
} }
PyArena_Free(arena); PyArena_Free(arena);
return co; return co;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment