summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-09-11 04:28:16 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-09-11 04:28:16 (GMT)
commit2a399b0f1128f2663769a3cd8522d35601712ae5 (patch)
tree6ebfbc864a592fe4e34eff393e4035851cd3e129 /Python
parentbcc119a22ca98facc80e7350b3ffca3335c9d288 (diff)
downloadcpython-2a399b0f1128f2663769a3cd8522d35601712ae5.zip
cpython-2a399b0f1128f2663769a3cd8522d35601712ae5.tar.gz
cpython-2a399b0f1128f2663769a3cd8522d35601712ae5.tar.bz2
Properly handle a NULL returned from PyArena_New().
(Also fix some whitespace) Klocwork #364.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index 5af3651..390f9e3 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -796,14 +796,16 @@ parse_source_module(const char *pathname, FILE *fp)
{
PyCodeObject *co = NULL;
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,
NULL, arena);
if (mod) {
co = PyAST_Compile(mod, pathname, NULL, arena);
}
- PyArena_Free(arena);
+ PyArena_Free(arena);
return co;
}