Commit ce99904b authored by Andreas Jung's avatar Andreas Jung

- Collector #1807: fixed memory leak in cAccessControl.guarded_getattr()

parent 05c8379a
......@@ -22,6 +22,13 @@ Zope Changes
- 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
......
......@@ -2198,7 +2198,10 @@ guarded_getattr(PyObject *inst, PyObject *name, PyObject *default_,
t = aq_Acquire(inst, name, aq_validate, validate, 1, NULL, 0);
if (t == NULL)
{
Py_DECREF(v);
return NULL;
}
Py_DECREF(t);
return v;
......
......@@ -86,6 +86,16 @@ class TestGuardedGetattr(GuardTestCase):
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment