Commit d9e0c3eb authored by Tim Peters's avatar Tim Peters

BTree_rangeSearch(): Squash another case of bucket-leak-on-PER_USE-failure,

plus cleanup of a previous such fix.
parent 71098d51
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
****************************************************************************/ ****************************************************************************/
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.50 2002/06/13 05:27:53 tim_one Exp $\n" #define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.51 2002/06/13 14:06:57 tim_one Exp $\n"
/* /*
** _BTree_get ** _BTree_get
...@@ -1030,14 +1030,10 @@ BTree_maxminKey(BTree *self, PyObject *args, int min) ...@@ -1030,14 +1030,10 @@ BTree_maxminKey(BTree *self, PyObject *args, int min)
else if (min) else if (min)
{ {
bucket = self->firstbucket; bucket = self->firstbucket;
Py_INCREF(bucket);
PER_ALLOW_DEACTIVATION(self); PER_ALLOW_DEACTIVATION(self);
PER_ACCESSED(self); PER_ACCESSED(self);
UNLESS (PER_USE(bucket)) UNLESS (PER_USE(bucket)) return NULL;
{ Py_INCREF(bucket);
Py_DECREF(bucket);
return NULL;
}
offset = 0; offset = 0;
if (offset >= bucket->len) if (offset >= bucket->len)
{ {
...@@ -1158,9 +1154,11 @@ BTree_rangeSearch(BTree *self, PyObject *args, char type) ...@@ -1158,9 +1154,11 @@ BTree_rangeSearch(BTree *self, PyObject *args, char type)
else else
{ {
highbucket = BTree_lastBucket(self); highbucket = BTree_lastBucket(self);
assert(highbucket != NULL); /* we know self isn't empty */
UNLESS (PER_USE(highbucket)) UNLESS (PER_USE(highbucket))
{ {
Py_DECREF(lowbucket); Py_DECREF(lowbucket);
Py_DECREF(highbucket);
goto err; goto err;
} }
highoffset = highbucket->len - 1; highoffset = highbucket->len - 1;
......
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