[Zope-dev] Leak in 2.5.1 cAccessControl.c !?
Stefan H. Holek
stefan@epy.co.at
Thu, 18 Jul 2002 14:58:34 +0200
Hi All!
I believe I have found a leak in cAccessControl.c of Zope 2.5.1. See the
patch below. It was difficult to spot because in the respective section of
cAccessControl.c the 'owner' variable is reused several times. Note that
'ASSIGN' decrefs 'owner' before actually assigning, whereas the original
line doesn't and thus leaks a ref (I think).
I was hunting for leaked ImplicitAcquirerWrappers and was able to track
them down to Owned.getOwner() which returns wrapped User objects
(LeakFinder rocks!). The patch appears to stop the wrappers from leaking.
However, I am still leaking Users so I am not sure whether I have really
and completely nailed it. From what I have seen in Acquisition.c decref'ing
a wrapper also decrefs the wrappee. Assuming that no special handling of
wrapped vs. unwrapped objects is required (with regards to decref'ing) what
I observe may well be unrelated.
What do you think? If somebody can confirm this I will put it in the
Collector.
Thanks,
Stefan
--- cAccessControl.c Fri Apr 12 17:18:44 2002
+++ cAccessControl.c Thu Jul 18 13:22:48 2002
@@ -1028,7 +1028,7 @@
}
if (owner != Py_None) {
- owner = PyObject_GetAttr(owner, allowed_str);
+ ASSIGN(owner, PyObject_GetAttr(owner, allowed_str));
if (owner)
ASSIGN(owner, callfunction2(owner, value, roles));
if (owner == NULL)
--
Those who write software only for pay should go hurt some other field.
/Erik Naggum/