]> granicus.if.org Git - python/commitdiff
Marc-Andre Lemburg:
authorGuido van Rossum <guido@python.org>
Thu, 27 Apr 2000 20:14:31 +0000 (20:14 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 27 Apr 2000 20:14:31 +0000 (20:14 +0000)
Fixes a memory leak found by Fredrik Lundh.

Modules/_tkinter.c

index 601a70c56e570d06790ac8a02e38269a0cc23e75..008378dff4fc3ff0d0634c29f36e5fc682d23917 100644 (file)
@@ -553,8 +553,10 @@ AsObj(value)
                PyObject* utf8 = PyUnicode_AsUTF8String (value);
                if (!utf8)
                        return 0;
-               return Tcl_NewStringObj (PyString_AS_STRING (utf8),
+               result = Tcl_NewStringObj (PyString_AS_STRING (utf8),
                                         PyString_GET_SIZE (utf8));
+               Py_DECREF(utf8);
+               return result;
        }
        else {
                PyObject *v = PyObject_Str(value);