]> granicus.if.org Git - python/commitdiff
fix error handling
authorBenjamin Peterson <benjamin@python.org>
Thu, 2 Apr 2009 02:52:46 +0000 (02:52 +0000)
committerBenjamin Peterson <benjamin@python.org>
Thu, 2 Apr 2009 02:52:46 +0000 (02:52 +0000)
Python/symtable.c

index 514ed44a7f3b1780a170e558ea8484b625647102..023c93398d167984ab68fc9aac9e80c4f649ff20 100644 (file)
@@ -732,7 +732,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.
 
@@ -759,13 +758,17 @@ analyze_child_block(PySTEntryObject *entry, PyObject *bound, PyObject *free,
 
        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