[Python-checkins] r42740 - python/trunk/Python/modsupport.c

martin.v.loewis python-checkins at python.org
Wed Mar 1 22:33:54 CET 2006


Author: martin.v.loewis
Date: Wed Mar  1 22:33:54 2006
New Revision: 42740

Modified:
   python/trunk/Python/modsupport.c
Log:
Fix more memory leaks. Will backport to 2.4.


Modified: python/trunk/Python/modsupport.c
==============================================================================
--- python/trunk/Python/modsupport.c	(original)
+++ python/trunk/Python/modsupport.c	Wed Mar  1 22:33:54 2006
@@ -71,13 +71,17 @@
 				PyErr_SetString(PyExc_ValueError,
 						"module functions cannot set"
 						" METH_CLASS or METH_STATIC");
+				Py_DECREF(n);
 				return NULL;
 			}
 			v = PyCFunction_NewEx(ml, passthrough, n);
-			if (v == NULL)
+			if (v == NULL) {
+				Py_DECREF(n);
 				return NULL;
+			}
 			if (PyDict_SetItemString(d, ml->ml_name, v) != 0) {
 				Py_DECREF(v);
+				Py_DECREF(n);
 				return NULL;
 			}
 			Py_DECREF(v);


More information about the Python-checkins mailing list