summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2004-02-26 10:07:14 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2004-02-26 10:07:14 (GMT)
commita7befda8d80d759cb88ef6732581860166ecf438 (patch)
tree0d67c57f5b0c9bf097378dd349f1100f2ca6f89b /Modules
parent904de5b7343994a7fcb2941ce094ab60da68afed (diff)
downloadcpython-a7befda8d80d759cb88ef6732581860166ecf438.zip
cpython-a7befda8d80d759cb88ef6732581860166ecf438.tar.gz
cpython-a7befda8d80d759cb88ef6732581860166ecf438.tar.bz2
Fixes SF bug # 778421
* Fixed a bug in the compatibility interface set_location() method where it would not properly search to the next nearest key when used on BTree databases. [SF bug id 788421] * Fixed a bug in the compatibility interface set_location() method where it could crash when looking up keys in a hash or recno format database due to an incorrect free().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_bsddb.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index a503a80..fcfcbd4 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -97,7 +97,7 @@
#error "eek! DBVER can't handle minor versions > 9"
#endif
-#define PY_BSDDB_VERSION "4.2.4"
+#define PY_BSDDB_VERSION "4.2.5"
static char *rcs_id = "$Id$";
@@ -2940,7 +2940,15 @@ DBC_set_range(DBCursorObject* self, PyObject* args, PyObject* kwargs)
data.data, data.size);
break;
}
- FREE_DBT(key);
+ if (_DB_get_type(self->mydb) == DB_BTREE) {
+ /* the only time a malloced key is returned is when we
+ * call this on a BTree database because it performs
+ * partial matching and needs to return the real key.
+ * All others leave key untouched [where calling free()
+ * on it would often segfault].
+ */
+ FREE_DBT(key);
+ }
FREE_DBT(data);
}