]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38823: Clean up refleaks in _tkinter initialization. (GH-17206)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 18 Nov 2019 15:09:43 +0000 (07:09 -0800)
committerGitHub <noreply@github.com>
Mon, 18 Nov 2019 15:09:43 +0000 (07:09 -0800)
https://bugs.python.org/issue38823
(cherry picked from commit 289cf0fbf78c4f38c38ac71ac8b772be7ec2672f)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Modules/_tkinter.c

index 8ea302ea639f99c90bd6346648d3be769d10ad1a..bc648dc07466888f3d65598ea1ca5a5057b0c362 100644 (file)
@@ -3552,11 +3552,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);