[Python-checkins] r51855 - python/trunk/Python/import.c

neal.norwitz python-checkins at python.org
Mon Sep 11 06:28:17 CEST 2006


Author: neal.norwitz
Date: Mon Sep 11 06:28:16 2006
New Revision: 51855

Modified:
   python/trunk/Python/import.c
Log:
Properly handle a NULL returned from PyArena_New().
(Also fix some whitespace)

Klocwork #364.  


Modified: python/trunk/Python/import.c
==============================================================================
--- python/trunk/Python/import.c	(original)
+++ python/trunk/Python/import.c	Mon Sep 11 06:28:16 2006
@@ -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;
 }
 


More information about the Python-checkins mailing list