Commit 71098d51 authored by Tim Peters's avatar Tim Peters

BTree_maxminKey(): Fixed three places where a PER_USE failure leaked a

bucket reference.

BTree_rangeSearch():  Fixed one place likewise.
parent a0e097bb
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
****************************************************************************/ ****************************************************************************/
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.49 2002/06/13 04:49:01 tim_one Exp $\n" #define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.50 2002/06/13 05:27:53 tim_one Exp $\n"
/* /*
** _BTree_get ** _BTree_get
...@@ -1021,7 +1021,11 @@ BTree_maxminKey(BTree *self, PyObject *args, int min) ...@@ -1021,7 +1021,11 @@ BTree_maxminKey(BTree *self, PyObject *args, int min)
} }
PER_ALLOW_DEACTIVATION(self); PER_ALLOW_DEACTIVATION(self);
PER_ACCESSED(self); PER_ACCESSED(self);
PER_USE_OR_RETURN(bucket, NULL); UNLESS (PER_USE(bucket))
{
Py_DECREF(bucket);
return NULL;
}
} }
else if (min) else if (min)
{ {
...@@ -1029,7 +1033,11 @@ BTree_maxminKey(BTree *self, PyObject *args, int min) ...@@ -1029,7 +1033,11 @@ BTree_maxminKey(BTree *self, PyObject *args, int min)
Py_INCREF(bucket); Py_INCREF(bucket);
PER_ALLOW_DEACTIVATION(self); PER_ALLOW_DEACTIVATION(self);
PER_ACCESSED(self); PER_ACCESSED(self);
PER_USE_OR_RETURN(bucket, NULL); UNLESS (PER_USE(bucket))
{
Py_DECREF(bucket);
return NULL;
}
offset = 0; offset = 0;
if (offset >= bucket->len) if (offset >= bucket->len)
{ {
...@@ -1045,7 +1053,11 @@ BTree_maxminKey(BTree *self, PyObject *args, int min) ...@@ -1045,7 +1053,11 @@ BTree_maxminKey(BTree *self, PyObject *args, int min)
bucket = BTree_lastBucket(self); bucket = BTree_lastBucket(self);
PER_ALLOW_DEACTIVATION(self); PER_ALLOW_DEACTIVATION(self);
PER_ACCESSED(self); PER_ACCESSED(self);
PER_USE_OR_RETURN(bucket, NULL); UNLESS (PER_USE(bucket))
{
Py_DECREF(bucket);
return NULL;
}
if (bucket->len) if (bucket->len)
offset = bucket->len - 1; offset = bucket->len - 1;
else else
...@@ -1146,7 +1158,11 @@ BTree_rangeSearch(BTree *self, PyObject *args, char type) ...@@ -1146,7 +1158,11 @@ BTree_rangeSearch(BTree *self, PyObject *args, char type)
else else
{ {
highbucket = BTree_lastBucket(self); highbucket = BTree_lastBucket(self);
UNLESS (PER_USE(highbucket)) goto err; UNLESS (PER_USE(highbucket))
{
Py_DECREF(lowbucket);
goto err;
}
highoffset = highbucket->len - 1; highoffset = highbucket->len - 1;
PER_ALLOW_DEACTIVATION(highbucket); PER_ALLOW_DEACTIVATION(highbucket);
PER_ACCESSED(highbucket); PER_ACCESSED(highbucket);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment