]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Free arena on _PyCompile_AstOptimize failure in Py_CompileStringObject (GH-127910)
authorBerker Peksag <berker.peksag@gmail.com>
Mon, 16 Dec 2024 20:59:36 +0000 (22:59 +0200)
committerGitHub <noreply@github.com>
Mon, 16 Dec 2024 20:59:36 +0000 (22:59 +0200)
After commit 10a91d7e9 introduced arena cleanup, commit 2dfbd4f36
removed the free call when _PyCompile_AstOptimize fails.

Python/pythonrun.c

index 8b57018321c070d4d0e34a5ff261f93d378d4bc0..31e065ff00d59a321e1d67f276925e87362b04c5 100644 (file)
@@ -1486,6 +1486,7 @@ Py_CompileStringObject(const char *str, PyObject *filename, int start,
     if (flags && (flags->cf_flags & PyCF_ONLY_AST)) {
         if ((flags->cf_flags & PyCF_OPTIMIZED_AST) == PyCF_OPTIMIZED_AST) {
             if (_PyCompile_AstOptimize(mod, filename, flags, optimize, arena) < 0) {
+                _PyArena_Free(arena);
                 return NULL;
             }
         }