From: Nikita Sobolev Date: Thu, 12 Oct 2023 12:52:03 +0000 (+0300) Subject: [3.11] gh-109216: Fix possible memory leak in `BUILD_MAP` (#109323) X-Git-Tag: v3.11.7~194 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e16922f07010a620298d7fb8abfae5c578d5d337;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-109216: Fix possible memory leak in `BUILD_MAP` (#109323) * [3.11] gh-109216: Fix possible memory leak in `BUILD_MAP` * Add NEWS * Update Python/ceval.c Co-authored-by: Kumar Aditya --------- Co-authored-by: Kumar Aditya --- 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 000000000000..f36310fc5f80 --- /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 172bc4743bda..bb6bb35030d2 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(); }