diff Python/symtable.c @ 52713:f634c5455b4f legacy-trunk

fix error handling
author Benjamin Peterson <benjamin@python.org>
date Thu, 02 Apr 2009 02:52:46 +0000
parents 6694f3a1b6e7
children 8700089eccd4
line wrap: on
line diff
--- a/Python/symtable.c	Thu Apr 02 02:47:44 2009 +0000
+++ b/Python/symtable.c	Thu Apr 02 02:52:46 2009 +0000
@@ -732,7 +732,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.
 
@@ -759,13 +758,17 @@
 
 	if (!analyze_block(entry, temp_bound, temp_free, temp_global))
 		goto error;
-	success = PyDict_Update(child_free, temp_free) >= 0;
-	success = 1;
+	if (PyDict_Update(child_free, temp_free) < 0)
+		goto error;
+	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