Index: Modules/_bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.31 diff -w -u -r1.31 _bsddb.c --- Modules/_bsddb.c 25 Mar 2004 02:16:22 -0000 1.31 +++ Modules/_bsddb.c 6 Jun 2004 20:49:14 -0000 @@ -1346,18 +1346,24 @@ return NULL; CHECK_DB_NOT_CLOSED(self); - if (!make_key_dbt(self, keyobj, &key, &flags)) + if (!make_key_dbt(self, keyobj, &key, &flags)) { + FREE_DBT(key); return NULL; - if (!checkTxnObj(txnobj, &txn)) + } + if (!checkTxnObj(txnobj, &txn)) { + FREE_DBT(key); return NULL; + } CLEAR_DBT(data); if (CHECK_DBFLAG(self, DB_THREAD)) { /* Tell BerkeleyDB to malloc the return value (thread safe) */ data.flags = DB_DBT_MALLOC; } - if (!add_partial_dbt(&data, dlen, doff)) + if (!add_partial_dbt(&data, dlen, doff)) { + FREE_DBT(key); return NULL; + } MYDB_BEGIN_ALLOW_THREADS; err = self->db->get(self->db, txn, &key, &data, flags); @@ -2911,8 +2917,10 @@ data.flags = DB_DBT_MALLOC; key.flags = DB_DBT_MALLOC; } - if (!add_partial_dbt(&data, dlen, doff)) + if (!add_partial_dbt(&data, dlen, doff)) { + FREE_DBT(key); return NULL; + } MYDB_BEGIN_ALLOW_THREADS; err = self->dbc->c_get(self->dbc, &key, &data, flags|DB_SET_RANGE); MYDB_END_ALLOW_THREADS;