diff Python/import.c @ 39827:66d0357029b5 legacy-trunk

Properly handle a NULL returned from PyArena_New(). (Also fix some whitespace) Klocwork #364.
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 11 Sep 2006 04:28:16 +0000
parents 307a11c085b4
children 66f265ac4ec4 f90ba306c287
line wrap: on
line diff
--- a/Python/import.c	Mon Sep 11 04:24:09 2006 +0000
+++ b/Python/import.c	Mon Sep 11 04:28:16 2006 +0000
@@ -796,14 +796,16 @@
 {
 	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;
 }