Commits

Anonymous committed 54d4fd0

Properly handle a NULL returned from PyArena_New().

Klocwork #364. Will port to head.

  • Participants
  • Parent commits e4e8f0a
  • Branches 2.5

Comments (0)

Files changed (1)

File Python/import.c

 {
 	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;
 }