]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 71018,71020-71021 via svnmerge from
authorBenjamin Peterson <benjamin@python.org>
Thu, 2 Apr 2009 02:52:09 +0000 (02:52 +0000)
committerBenjamin Peterson <benjamin@python.org>
Thu, 2 Apr 2009 02:52:09 +0000 (02:52 +0000)
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

index 1eaed7d6042583b911510e33a9ac205f598acf07..e787a74a93b9428aefb553ca925ef703ac912d28 100644 (file)
@@ -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