diff options
| author | Neal Norwitz <nnorwitz@gmail.com> | 2006-09-11 04:06:23 (GMT) | 
|---|---|---|
| committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-09-11 04:06:23 (GMT) | 
| commit | ece448efa0fc06500f0eaf9e657b8fd38fae16d4 (patch) | |
| tree | 61691af02d71eed7ebe0468a73f47254e33df0d3 /Python/import.c | |
| parent | 48829ba61d840cfcc6be63219b62476b4f9c7f7d (diff) | |
| download | cpython-ece448efa0fc06500f0eaf9e657b8fd38fae16d4.zip cpython-ece448efa0fc06500f0eaf9e657b8fd38fae16d4.tar.gz cpython-ece448efa0fc06500f0eaf9e657b8fd38fae16d4.tar.bz2  | |
Properly handle a NULL returned from PyArena_New().
Klocwork #364.  Will port to head.
Diffstat (limited to 'Python/import.c')
| -rw-r--r-- | Python/import.c | 6 | 
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;  }  | 
