summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2024-12-16 20:59:36 (GMT)
committerGitHub <noreply@github.com>2024-12-16 20:59:36 (GMT)
commitcfeaa992ba9bad9be2687afcafd85156703d74e8 (patch)
treee6ee0f11746fc8bbad04f9e4ac39a019bce8047f
parent3b766824fe59030100964752be0556084d4461af (diff)
downloadcpython-cfeaa992ba9bad9be2687afcafd85156703d74e8.zip
cpython-cfeaa992ba9bad9be2687afcafd85156703d74e8.tar.gz
cpython-cfeaa992ba9bad9be2687afcafd85156703d74e8.tar.bz2
Free arena on _PyCompile_AstOptimize failure in Py_CompileStringObject (GH-127910)
After commit 10a91d7e9 introduced arena cleanup, commit 2dfbd4f36 removed the free call when _PyCompile_AstOptimize fails.
-rw-r--r--Python/pythonrun.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 8b57018..31e065f 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -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;
}
}