]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38823: Clean up refleaks in _tkinter initialization. (GH-17206)
authorBrandt Bucher <brandtbucher@gmail.com>
Mon, 18 Nov 2019 14:52:36 +0000 (06:52 -0800)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 18 Nov 2019 14:52:36 +0000 (06:52 -0800)
https://bugs.python.org/issue38823

Modules/_tkinter.c

index 235cb6bc28dd5c22d370c38b221c0b5aba4f5cf7..40d2ed7f88b1131b460500eff049e1cab70d65e8 100644 (file)
@@ -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);