From: Neal Norwitz Date: Mon, 11 Sep 2006 04:28:16 +0000 (+0000) Subject: Properly handle a NULL returned from PyArena_New(). X-Git-Tag: v2.6a1~2670 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a399b0f1128f2663769a3cd8522d35601712ae5;p=thirdparty%2FPython%2Fcpython.git Properly handle a NULL returned from PyArena_New(). (Also fix some whitespace) Klocwork #364. --- diff --git a/Python/import.c b/Python/import.c index 5af365187ec5..390f9e3292f7 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; }