[Zodb-checkins] CVS: Zope/lib/python/BTrees - BTreeTemplate.c:1.50
Tim Peters
tim.one@comcast.net
Thu, 13 Jun 2002 01:27:54 -0400
Update of /cvs-repository/Zope/lib/python/BTrees
In directory cvs.zope.org:/tmp/cvs-serv18257
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.
=== Zope/lib/python/BTrees/BTreeTemplate.c 1.49 => 1.50 ===
PER_ALLOW_DEACTIVATION(self);
PER_ACCESSED(self);
- PER_USE_OR_RETURN(bucket, NULL);
+ UNLESS (PER_USE(bucket))
+ {
+ Py_DECREF(bucket);
+ return NULL;
+ }
}
else if (min)
{
@@ -1029,7 +1033,11 @@
Py_INCREF(bucket);
PER_ALLOW_DEACTIVATION(self);
PER_ACCESSED(self);
- PER_USE_OR_RETURN(bucket, NULL);
+ UNLESS (PER_USE(bucket))
+ {
+ Py_DECREF(bucket);
+ return NULL;
+ }
offset = 0;
if (offset >= bucket->len)
{
@@ -1045,7 +1053,11 @@
bucket = BTree_lastBucket(self);
PER_ALLOW_DEACTIVATION(self);
PER_ACCESSED(self);
- PER_USE_OR_RETURN(bucket, NULL);
+ UNLESS (PER_USE(bucket))
+ {
+ Py_DECREF(bucket);
+ return NULL;
+ }
if (bucket->len)
offset = bucket->len - 1;
else
@@ -1146,7 +1158,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;
PER_ALLOW_DEACTIVATION(highbucket);
PER_ACCESSED(highbucket);