Commit 1f988334 authored by Tim Peters's avatar Tim Peters

BTree_grow(): eliminated needless casting. Fixed places where an

error return let a newly allocated object leak; curiously, there was
one more of these in the Zope3 version of the code than on the trunk.
parent 6c535ede
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
****************************************************************************/ ****************************************************************************/
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.41 2002/06/11 02:14:36 tim_one Exp $\n" #define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.42 2002/06/11 02:37:57 tim_one Exp $\n"
/* /*
** _BTree_get ** _BTree_get
...@@ -211,20 +211,22 @@ BTree_grow(BTree *self, int index, int noval) ...@@ -211,20 +211,22 @@ BTree_grow(BTree *self, int index, int noval)
e = SIZED(PyObject_CallObject(OBJECT(v->ob_type), NULL)); e = SIZED(PyObject_CallObject(OBJECT(v->ob_type), NULL));
UNLESS (e) return -1; UNLESS (e) return -1;
PER_USE_OR_RETURN(BUCKET(v), -1); UNLESS(PER_USE(v))
{
Py_DECREF(e);
return -1;
}
/* Now split between the original (v) and the new (e) at the midpoint*/ /* Now split between the original (v) and the new (e) at the midpoint*/
if (SameType_Check(self, v)) if (SameType_Check(self, v))
{ {
i=BTree_split( BTREE(v), -1, BTREE(e)); i=BTree_split(BTREE(v), -1, BTREE(e));
} }
else else
{ {
i=bucket_split(BUCKET(v), -1, BUCKET(e)); i=bucket_split(BUCKET(v), -1, BUCKET(e));
} }
PER_ALLOW_DEACTIVATION(v);
PER_ALLOW_DEACTIVATION(BUCKET(v));
if (i < 0) if (i < 0)
{ {
......
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