diff Modules/_tkinter.c @ 12513:ca0e9d97d554 legacy-trunk

Marc-Andre Lemburg: Fixes a memory leak found by Fredrik Lundh.
author Guido van Rossum <guido@python.org>
date Thu, 27 Apr 2000 20:14:31 +0000
parents 98b09c40d97c
children 1c7c2dd1beb1
line wrap: on
line diff
--- a/Modules/_tkinter.c	Thu Apr 27 20:14:13 2000 +0000
+++ b/Modules/_tkinter.c	Thu Apr 27 20:14:31 2000 +0000
@@ -553,8 +553,10 @@
 		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);