From e105f980460131d192d955fca0df474bcf1c642c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 23 Jan 2008 20:09:39 +0000 Subject: Fix two crashers (borrowed_ref_[34].py from the trunk). --- Python/bltinmodule.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index ceb2fc77f4..f82430cba6 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1218,11 +1218,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 */ @@ -1271,6 +1274,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: @@ -1281,6 +1285,7 @@ Fail_it: Py_XDECREF(maxval); Py_XDECREF(maxitem); Py_DECREF(it); + Py_XDECREF(keyfunc); return NULL; } -- cgit v1.2.1