From 1186b24a319cb38ba88e7047f88fac0b4f2de398 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 2 Apr 2009 02:52:09 +0000 Subject: [PATCH] Merged revisions 71018,71020-71021 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r71018 | benjamin.peterson | 2009-04-01 20:50:37 -0500 (Wed, 01 Apr 2009) | 1 line fix ref leaks ........ r71020 | benjamin.peterson | 2009-04-01 21:27:20 -0500 (Wed, 01 Apr 2009) | 1 line rewrite error handling to make sense ........ r71021 | benjamin.peterson | 2009-04-01 21:27:56 -0500 (Wed, 01 Apr 2009) | 1 line remove unused variable ........ --- Python/symtable.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Python/symtable.c b/Python/symtable.c index 1eaed7d60425..e787a74a93b9 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -765,6 +765,7 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free, if (PyNumber_InPlaceOr(newfree, allfree) < 0) goto error; + Py_DECREF(newfree); /* Check if any local variables must be converted to cell variables */ if (ste->ste_type == FunctionBlock && !analyze_cells(scopes, newfree, @@ -801,7 +802,6 @@ analyze_child_block(PySTEntryObject *entry, PyObject *bound, PyObject *free, PyObject *global, PyObject* child_free) { PyObject *temp_bound = NULL, *temp_global = NULL, *temp_free = NULL; - int success = 0; /* Copy the bound and global dictionaries. @@ -822,13 +822,18 @@ analyze_child_block(PySTEntryObject *entry, PyObject *bound, PyObject *free, if (!analyze_block(entry, temp_bound, temp_free, temp_global)) goto error; - success = PyNumber_InPlaceOr(child_free, temp_free) >= 0; - success = 1; + if (PyNumber_InPlaceOr(child_free, temp_free) < 0) + goto error; + Py_DECREF(child_free); + Py_DECREF(temp_bound); + Py_DECREF(temp_free); + Py_DECREF(temp_global); + return 1; error: Py_XDECREF(temp_bound); Py_XDECREF(temp_free); Py_XDECREF(temp_global); - return success; + return 0; } static int -- 2.47.3