[Python-checkins] r72958 - python/trunk/Objects/dictobject.c

benjamin.peterson python-checkins at python.org
Wed May 27 05:08:44 CEST 2009


Author: benjamin.peterson
Date: Wed May 27 05:08:44 2009
New Revision: 72958

Log:
plug ref leak

Modified:
   python/trunk/Objects/dictobject.c

Modified: python/trunk/Objects/dictobject.c
==============================================================================
--- python/trunk/Objects/dictobject.c	(original)
+++ python/trunk/Objects/dictobject.c	Wed May 27 05:08:44 2009
@@ -1153,14 +1153,17 @@
 	if (v == NULL) {
 		if (!PyDict_CheckExact(mp)) {
 			/* Look up __missing__ method if we're a subclass. */
-		    	PyObject *missing;
+		    	PyObject *missing, *res;
 			static PyObject *missing_str = NULL;
 			missing = _PyObject_LookupSpecial((PyObject *)mp,
 							  "__missing__",
 							  &missing_str);
-			if (missing != NULL)
-				return PyObject_CallFunctionObjArgs(missing,
-					key, NULL);
+			if (missing != NULL) {
+				res = PyObject_CallFunctionObjArgs(missing,
+								   key, NULL);
+				Py_DECREF(missing);
+				return res;
+			}
 			else if (PyErr_Occurred())
 				return NULL;
 		}


More information about the Python-checkins mailing list