[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ - Collector #1807: fixed memory leak in cAccessControl.guarded_getattr()

Andreas Jung andreas at andreas-jung.com
Tue Aug 2 05:37:08 EDT 2005


Log message for revision 37653:
  
        - Collector #1807: fixed memory leak in cAccessControl.guarded_getattr()
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/AccessControl/cAccessControl.c
  U   Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testZopeGuards.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-08-02 09:36:04 UTC (rev 37652)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-08-02 09:37:08 UTC (rev 37653)
@@ -22,6 +22,13 @@
 
    - Collector #1233: port ZOPE_CONFIG patch from Zope 2.7 to Zope 2.8
 
+  after Zope 2.8.1 b1 
+
+    Bugs Fixed
+
+      - Collector #1807: fixed memory leak in cAccessControl.guarded_getattr()
+
+
   Zope 2.8.1 b1 (2005/07/28)
 
     Features Added

Modified: Zope/branches/Zope-2_8-branch/lib/python/AccessControl/cAccessControl.c
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/AccessControl/cAccessControl.c	2005-08-02 09:36:04 UTC (rev 37652)
+++ Zope/branches/Zope-2_8-branch/lib/python/AccessControl/cAccessControl.c	2005-08-02 09:37:08 UTC (rev 37653)
@@ -2198,7 +2198,10 @@
 
       t = aq_Acquire(inst, name, aq_validate, validate, 1, NULL, 0);
       if (t == NULL)
+        {
+        Py_DECREF(v);
         return NULL;
+        }
       Py_DECREF(t);
 
       return v;

Modified: Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testZopeGuards.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testZopeGuards.py	2005-08-02 09:36:04 UTC (rev 37652)
+++ Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testZopeGuards.py	2005-08-02 09:37:08 UTC (rev 37653)
@@ -86,6 +86,16 @@
     def tearDown(self):
         self.setSecurityManager(self.__old)
 
+    def test_unauthorized(self):
+        obj, name = Method(), 'args'
+        value = getattr(obj, name)
+        rc = sys.getrefcount(value)
+        self.__sm.reject = True
+        self.assertRaises(Unauthorized, guarded_getattr, obj, name)
+        self.assert_(self.__sm.calls)
+        del self.__sm.calls[:]
+        self.assertEqual(rc, sys.getrefcount(value))
+
     def test_calls_validate_for_unknown_type(self):
         guarded_getattr(self, 'test_calls_validate_for_unknown_type')
         self.assert_(self.__sm.calls)



More information about the Zope-Checkins mailing list