From e0d8b9cfdaa7180e03cb083b0e08258c35b19462 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 17 Nov 2019 11:19:38 -0800 Subject: [PATCH] Clean up refleaks in module initialization. --- Modules/_tkinter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 235cb6bc28dd5c..40d2ed7f88b113 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -3555,11 +3555,13 @@ PyInit__tkinter(void) if (!ret && GetLastError() == ERROR_ENVVAR_NOT_FOUND) { str_path = _get_tcl_lib_path(); if (str_path == NULL && PyErr_Occurred()) { + Py_DECREF(m); return NULL; } if (str_path != NULL) { wcs_path = PyUnicode_AsWideCharString(str_path, NULL); if (wcs_path == NULL) { + Py_DECREF(m); return NULL; } SetEnvironmentVariableW(L"TCL_LIBRARY", wcs_path);