diff options
Diffstat (limited to 'Modules/_bsddb.c')
-rw-r--r-- | Modules/_bsddb.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 6f323d5..175dec3 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -5024,14 +5024,20 @@ DBSequence_get_key(DBSequenceObject* self, PyObject* args) { int err; DBT key; + PyObject *retval; + key.flags = DB_DBT_MALLOC; CHECK_SEQUENCE_NOT_CLOSED(self) MYDB_BEGIN_ALLOW_THREADS err = self->sequence->get_key(self->sequence, &key); MYDB_END_ALLOW_THREADS + if (!err) + retval = PyBytes_FromStringAndSize(key.data, key.size); + + free_dbt(&key); RETURN_IF_ERR(); - return PyBytes_FromStringAndSize(key.data, key.size); + return retval; } static PyObject* |