[Zope-Checkins] CVS: Zope3/lib/python/Persistence/BTrees - BTreeTemplate.c:1.13
Tim Peters
tim.one@comcast.net
Thu, 13 Jun 2002 01:28:23 -0400
Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees
In directory cvs.zope.org:/tmp/cvs-serv18477
Modified Files:
BTreeTemplate.c
Log Message:
BTree_maxminKey(): Fixed three places where a PER_USE failure leaked a
bucket reference.
BTree_rangeSearch(): Fixed one place likewise.
=== Zope3/lib/python/Persistence/BTrees/BTreeTemplate.c 1.12 => 1.13 ===
PyPersist_DECREF(self);
PyPersist_SetATime(self);
- PER_USE_OR_RETURN(bucket, NULL);
+ UNLESS (PER_USE(bucket))
+ {
+ Py_DECREF(bucket);
+ return NULL;
+ }
}
else if (min)
{
@@ -1085,7 +1089,11 @@
Py_INCREF(bucket);
PyPersist_DECREF(self);
PyPersist_SetATime(self);
- PER_USE_OR_RETURN(bucket, NULL);
+ UNLESS (PER_USE(bucket))
+ {
+ Py_DECREF(bucket);
+ return NULL;
+ }
offset = 0;
if (offset >= bucket->len)
{
@@ -1101,7 +1109,11 @@
bucket = BTree_lastBucket(self);
PyPersist_DECREF(self);
PyPersist_SetATime(self);
- PER_USE_OR_RETURN(bucket, NULL);
+ UNLESS (PER_USE(bucket))
+ {
+ Py_DECREF(bucket);
+ return NULL;
+ }
if (bucket->len)
offset = bucket->len - 1;
else
@@ -1204,7 +1216,11 @@
else
{
highbucket = BTree_lastBucket(self);
- UNLESS (PER_USE(highbucket)) goto err;
+ UNLESS (PER_USE(highbucket))
+ {
+ Py_DECREF(lowbucket);
+ goto err;
+ }
highoffset = highbucket->len - 1;
PyPersist_DECREF(highbucket);
PyPersist_SetATime(highbucket);