Skip to content

Commit e16922f

Browse files
[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 <[email protected]> --------- Co-authored-by: Kumar Aditya <[email protected]>
1 parent c9214b9 commit e16922f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix possible memory leak in :opcode:`BUILD_MAP`.
2+

Python/ceval.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -3318,13 +3318,14 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
33183318
&PEEK(2*oparg), 2,
33193319
&PEEK(2*oparg - 1), 2,
33203320
oparg);
3321-
if (map == NULL)
3322-
goto error;
33233321

33243322
while (oparg--) {
33253323
Py_DECREF(POP());
33263324
Py_DECREF(POP());
33273325
}
3326+
if (map == NULL) {
3327+
goto error;
3328+
}
33283329
PUSH(map);
33293330
DISPATCH();
33303331
}

0 commit comments

Comments
 (0)