[Zodb-checkins] CVS: ZODB3/Persistence - cPersistence.c:1.72.8.26
Tim Peters
tim.one at comcast.net
Mon Jul 14 18:41:38 EDT 2003
Update of /cvs-repository/ZODB3/Persistence
In directory cvs.zope.org:/tmp/cvs-serv20567/Persistence
Modified Files:
Tag: zodb33-devel-branch
cPersistence.c
Log Message:
Per_getattro(), Per_setattro(): repaired obvious leaks on almost all
early-exit paths. What isn't completely clear to me yet is why
checkPackWhileWriting triggered a leak in Per_getattro whenever
a ClientThread sufferred a ConlictError.
=== ZODB3/Persistence/cPersistence.c 1.72.8.25 => 1.72.8.26 ===
--- ZODB3/Persistence/cPersistence.c:1.72.8.25 Wed Jul 9 16:39:46 2003
+++ ZODB3/Persistence/cPersistence.c Mon Jul 14 17:41:32 2003
@@ -500,23 +500,24 @@
static PyObject*
Per_getattro(cPersistentObject *self, PyObject *name)
{
- PyObject *r;
+ PyObject *result = NULL; /* guilty until proved innocent */
char *s;
name = convert_name(name);
if (!name)
- return NULL;
+ goto Done;
s = PyString_AS_STRING(name);
if (*s != '_' || unghost_getattr(s)) {
if (!unghostify(self))
- return NULL;
+ goto Done;
accessed(self);
}
- r = PyObject_GenericGetAttr((PyObject *)self, name);
-
- Py_DECREF(name);
- return r;
+ result = PyObject_GenericGetAttr((PyObject *)self, name);
+
+ Done:
+ Py_XDECREF(name);
+ return result;
}
/* We need to decide on a reasonable way for a programmer to write
@@ -541,28 +542,29 @@
static int
Per_setattro(cPersistentObject *self, PyObject *name, PyObject *v)
{
- int r;
+ int result = -1; /* guilty until proved innocent */
char *s;
name = convert_name(name);
if (!name)
- return -1;
+ goto Done;
s = PyString_AS_STRING(name);
if (strncmp(s, "_p_", 3) != 0) {
if (!unghostify(self))
- return -1;
+ goto Done;
accessed(self);
if (strncmp(s, "_v_", 3) != 0
&& self->state != cPersistent_CHANGED_STATE) {
if (changed(self) < 0)
- return -1;
+ goto Done;
}
}
- r = PyObject_GenericSetAttr((PyObject *)self, name, v);
+ result = PyObject_GenericSetAttr((PyObject *)self, name, v);
- Py_DECREF(name);
- return r;
+ Done:
+ Py_XDECREF(name);
+ return result;
}
static PyObject *
More information about the Zodb-checkins
mailing list