[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 <kumaraditya@python.org>

---------

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Nikita Sobolev 2023-10-12 15:52:03 +03:00 committed by GitHub
parent c9214b90f4
commit e16922f070
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -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();
}