summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2023-09-11-12-41-42.gh-issue-109216.60QOSb.rst2
-rw-r--r--Python/ceval.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-09-11-12-41-42.gh-issue-109216.60QOSb.rst b/Misc/NEWS.d/next/Core and Builtins/2023-09-11-12-41-42.gh-issue-109216.60QOSb.rst
new file mode 100644
index 0000000..f36310f
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2023-09-11-12-41-42.gh-issue-109216.60QOSb.rst
@@ -0,0 +1,2 @@
+Fix possible memory leak in :opcode:`BUILD_MAP`.
+
diff --git a/Python/ceval.c b/Python/ceval.c
index 172bc47..bb6bb35 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3318,13 +3318,14 @@ handle_eval_breaker:
&PEEK(2*oparg), 2,
&PEEK(2*oparg - 1), 2,
oparg);
- if (map == NULL)
- goto error;
while (oparg--) {
Py_DECREF(POP());
Py_DECREF(POP());
}
+ if (map == NULL) {
+ goto error;
+ }
PUSH(map);
DISPATCH();
}