[Zope-Checkins] CVS: Zope/lib/python/AccessControl -
cAccessControl.c:1.17.6.3
Brian Lloyd
brian at zope.com
Tue Jan 13 16:31:10 EST 2004
Update of /cvs-repository/Zope/lib/python/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv6737
Modified Files:
Tag: Zope-2_6-branch
cAccessControl.c
Log Message:
refcount fixes
=== Zope/lib/python/AccessControl/cAccessControl.c 1.17.6.2 => 1.17.6.3 ===
--- Zope/lib/python/AccessControl/cAccessControl.c:1.17.6.2 Thu Jan 8 15:12:07 2004
+++ Zope/lib/python/AccessControl/cAccessControl.c Tue Jan 13 16:31:09 2004
@@ -1124,9 +1124,10 @@
**| return 0
*/
proxy_roles = PyObject_GetAttr(eo, _proxy_roles_str);
- Py_DECREF(eo);
+
if (proxy_roles == NULL)
{
+ Py_DECREF(eo);
PyErr_Clear();
}
else if (PyObject_IsTrue(proxy_roles))
@@ -1136,25 +1137,43 @@
method = PyObject_GetAttr(eo, getOwner_str);
if (method == NULL) {
+ Py_DECREF(eo);
+ Py_DECREF(proxy_roles);
goto err;
}
owner = PyObject_CallObject(method, NULL);
Py_DECREF(method);
-
if (owner == NULL) {
+ Py_DECREF(eo);
+ Py_DECREF(proxy_roles);
goto err;
}
-
if (PyObject_IsTrue(owner)) {
if (!PyObject_HasAttr(owner, aq_parent_str)) {
item = PyInt_FromLong(1);
+ if (item == NULL) {
+ Py_DECREF(eo);
+ Py_DECREF(proxy_roles);
+ Py_DECREF(owner);
+ goto err;
+ }
+
tmp = callmethod1(eo, getOwner_str, item);
- Py_XDECREF(item);
+ Py_DECREF(item);
+ if (tmp == NULL) (
+ Py_DECREF(eo);
+ Py_DECREF(proxy_roles);
+ Py_DECREF(owner);
+ goto err;
+ }
+
udb = PySequence_GetItem(tmp, 0);
- Py_XDECREF(tmp);
+ Py_DECREF(tmp);
if (udb == NULL) {
+ Py_DECREF(eo);
+ Py_DECREF(proxy_roles);
Py_DECREF(owner);
goto err;
}
@@ -1162,44 +1181,65 @@
method = PyObject_GetAttr(container,
getPhysicalRoot_str);
if (method == NULL) {
+ Py_DECREF(eo);
+ Py_DECREF(proxy_roles);
Py_DECREF(owner);
Py_DECREF(udb);
+ goto err;
}
+
root = PyObject_CallObject(method, NULL);
Py_DECREF(method);
+ if (root == NULL) {
+ Py_DECREF(eo);
+ Py_DECREF(proxy_roles);
+ Py_DECREF(owner);
+ Py_DECREF(udb);
+ goto err;
+ }
ASSIGN(udb, callmethod1(root, unrestrictedTraverse_str,
udb));
+ Py_DECREF(root);
if (udb == NULL) {
+ Py_DECREF(eo);
+ Py_DECREF(proxy_roles);
Py_DECREF(owner);
- Py_DECREF(udb);
+ goto err;
}
ASSIGN(owner, callmethod1(owner, __of__, udb));
Py_DECREF(udb);
-
+ if (owner == NULL) {
+ Py_DECREF(eo);
+ Py_DECREF(proxy_roles);
+ goto err;
+ }
}
}
+ Py_DECREF(eo);
if (owner != Py_None) {
- PyObject *tmp = callmethod1(owner,
- _check_context_str,
- container
- );
+ tmp = callmethod1(owner,_check_context_str,
+ container
+ );
if (tmp == NULL) {
+ Py_DECREF(proxy_roles);
Py_DECREF(owner);
goto err;
}
if (!PyObject_IsTrue(tmp)) {
+ Py_DECREF(proxy_roles);
Py_DECREF(owner);
Py_DECREF(tmp);
unauthErr(name, value);
goto err;
}
Py_DECREF(owner);
+ Py_DECREF(tmp);
}
/* ------------------------------------------- */
More information about the Zope-Checkins
mailing list