[Zope-Checkins] CVS: Packages/AccessControl - cAccessControl.c:1.20.2.20

Tim Peters tim.one at comcast.net
Tue Dec 14 14:34:46 EST 2004


Update of /cvs-repository/Packages/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv31012/lib/python/AccessControl

Modified Files:
      Tag: Zope-2_7-branch
	cAccessControl.c 
Log Message:
ZopeSecurityPolicy_validate():

- Repaired an obvious memory leak.

- Checked one of the PyInt_FromLong(1) calls for an error return.
  In theory, they should all be checked; in practice, PyInt_FromLong(1)
  can't fail.  It was just convenient to check this one since it was on
  the line causing the leak.


=== Packages/AccessControl/cAccessControl.c 1.20.2.19 => 1.20.2.20 ===
--- Packages/AccessControl/cAccessControl.c:1.20.2.19	Tue Dec 14 11:42:36 2004
+++ Packages/AccessControl/cAccessControl.c	Tue Dec 14 14:34:45 2004
@@ -752,7 +752,8 @@
 ** ZopeSecurityPolicy_validate
 */
 
-static PyObject *ZopeSecurityPolicy_validate(PyObject *self, PyObject *args) {
+static PyObject *
+ZopeSecurityPolicy_validate(PyObject *self, PyObject *args) {
 	PyObject *accessed = NULL;  /* Note: accessed is not used. */
 	PyObject *container = NULL;
 	PyObject *name = NULL;
@@ -958,7 +959,11 @@
                                   PyErr_Clear();
                               }
                             else
-                              p = PyInt_FromLong(1);
+                              {
+                                ASSIGN(p, PyInt_FromLong(1));
+                                if (p == NULL)
+                                  goto err;
+                              }
                           } 
                         else 
                           {



More information about the Zope-Checkins mailing list