diff Objects/classobject.c @ 25841:09e3f0d8be10 2.2

Fix (real! :-) memory leaks in half_cmp and half_binop. Perhaps found by NealN and valgrind. Will forward port.
author Guido van Rossum <guido@python.org>
date Fri, 18 Oct 2002 14:06:02 +0000
parents 903112c1c887
children 0729f8393b16
line wrap: on
line diff
--- a/Objects/classobject.c	Fri Oct 18 13:52:42 2002 +0000
+++ b/Objects/classobject.c	Fri Oct 18 14:06:02 2002 +0000
@@ -1315,6 +1315,7 @@
 
 	args = Py_BuildValue("(O)", w);
 	if (args == NULL) {
+		Py_DECREF(coercefunc);
 		return NULL;
 	}
 	coerced = PyEval_CallObject(coercefunc, args);
@@ -1507,8 +1508,10 @@
 	}
 
 	args = Py_BuildValue("(O)", w);
-	if (args == NULL)
+	if (args == NULL) {
+		Py_DECREF(cmp_func);
 		return -2;
+	}
 
 	result = PyEval_CallObject(cmp_func, args);
 	Py_DECREF(args);