Skip to content

Commit 4adb87e

Browse files
committed
gh-140301: Fix memory leak in subinterpreter PyConfig cleanup
1 parent 58c44c2 commit 4adb87e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix memory leak in subinterpreter creation

Python/pylifecycle.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,8 @@ finalize_interp_delete(PyInterpreterState *interp)
19601960
created GIL, which ensures that Py_Initialize / Py_FinalizeEx can be
19611961
called multiple times. */
19621962

1963+
PyConfig_Clear(&interp->config);
1964+
19631965
PyInterpreterState_Delete(interp);
19641966
}
19651967

@@ -2505,6 +2507,7 @@ new_interpreter(PyThreadState **tstate_p,
25052507
if (tstate != NULL) {
25062508
Py_EndInterpreter(tstate);
25072509
} else if (interp != NULL) {
2510+
PyConfig_Clear(&interp->config);
25082511
PyInterpreterState_Delete(interp);
25092512
}
25102513
if (save_tstate != NULL) {

0 commit comments

Comments
 (0)