From 8cfc544ca78b3bdf467f078b29b220616b186a0a Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 11 Sep 2023 12:42:04 +0300 Subject: [PATCH] gh-109216: Fix possible memory leak in `BUILD_MAP` --- .../2023-09-11-12-41-42.gh-issue-109216.60QOSb.rst | 1 + Python/bytecodes.c | 3 --- Python/executor_cases.c.h | 3 --- Python/generated_cases.c.h | 3 --- 4 files changed, 1 insertion(+), 9 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-09-11-12-41-42.gh-issue-109216.60QOSb.rst 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 00000000000000..aa8b2832af23a5 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-09-11-12-41-42.gh-issue-109216.60QOSb.rst @@ -0,0 +1 @@ +Fix possible memory leak in :opcode:`BUILD_MAP`. diff --git a/Python/bytecodes.c b/Python/bytecodes.c index ff95f37b900da6..a5c136c7fbe2f0 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1600,9 +1600,6 @@ dummy_func( values, 2, values+1, 2, oparg); - if (map == NULL) - goto error; - DECREF_INPUTS(); ERROR_IF(map == NULL, error); } diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 918991dca7dd25..c11b04e0461626 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -1433,9 +1433,6 @@ values, 2, values+1, 2, oparg); - if (map == NULL) - goto error; - for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index e84599d87a6968..d5bc8b167bcd81 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -2077,9 +2077,6 @@ values, 2, values+1, 2, oparg); - if (map == NULL) - goto error; - for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); }