diff Python/symtable.c @ 52712:90690eb85380 3.0

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 ........
author Benjamin Peterson <benjamin@python.org>
date Thu, 02 Apr 2009 02:52:09 +0000
parents d8ceb26c66c4
children c2c8d0ddf187
line wrap: on
line diff
--- a/Python/symtable.c	Wed Apr 01 20:54:19 2009 +0000
+++ b/Python/symtable.c	Thu Apr 02 02:52:09 2009 +0000
@@ -765,6 +765,7 @@
 
 	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 @@
 		    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 @@
 
 	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