summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2008-01-23 20:19:01 (GMT)
committerGuido van Rossum <guido@python.org>2008-01-23 20:19:01 (GMT)
commit1d9a9eaa89e166d814eb55acc1d6271087fadc83 (patch)
tree9f80971b606f077119a32bd2fd5a51e3c1910f0d /Python/bltinmodule.c
parentb2302ba9771d3c2795ae6c78d881b0c4715e2f63 (diff)
downloadcpython-1d9a9eaa89e166d814eb55acc1d6271087fadc83.zip
cpython-1d9a9eaa89e166d814eb55acc1d6271087fadc83.tar.gz
cpython-1d9a9eaa89e166d814eb55acc1d6271087fadc83.tar.bz2
Fix two crashers.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 9a31356..444fc1e 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1245,11 +1245,14 @@ min_max(PyObject *args, PyObject *kwds, int op)
"%s() got an unexpected keyword argument", name);
return NULL;
}
+ Py_INCREF(keyfunc);
}
it = PyObject_GetIter(v);
- if (it == NULL)
+ if (it == NULL) {
+ Py_XDECREF(keyfunc);
return NULL;
+ }
maxitem = NULL; /* the result */
maxval = NULL; /* the value associated with the result */
@@ -1298,6 +1301,7 @@ min_max(PyObject *args, PyObject *kwds, int op)
else
Py_DECREF(maxval);
Py_DECREF(it);
+ Py_XDECREF(keyfunc);
return maxitem;
Fail_it_item_and_val:
@@ -1308,6 +1312,7 @@ Fail_it:
Py_XDECREF(maxval);
Py_XDECREF(maxitem);
Py_DECREF(it);
+ Py_XDECREF(keyfunc);
return NULL;
}