Skip to content

Commit 9e4d031

Browse files
bpo-38823: Clean up refleaks in _tkinter initialization. (GH-17206)
https://bugs.python.org/issue38823 (cherry picked from commit 289cf0f) Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
1 parent 9a4c5c3 commit 9e4d031

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Modules/_tkinter.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3552,11 +3552,13 @@ PyInit__tkinter(void)
35523552
if (!ret && GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
35533553
str_path = _get_tcl_lib_path();
35543554
if (str_path == NULL && PyErr_Occurred()) {
3555+
Py_DECREF(m);
35553556
return NULL;
35563557
}
35573558
if (str_path != NULL) {
35583559
wcs_path = PyUnicode_AsWideCharString(str_path, NULL);
35593560
if (wcs_path == NULL) {
3561+
Py_DECREF(m);
35603562
return NULL;
35613563
}
35623564
SetEnvironmentVariableW(L"TCL_LIBRARY", wcs_path);

0 commit comments

Comments
 (0)