From 0aa12ef99fae30dc26da26f8ae17a0b8235b1037 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Thu, 6 Jul 2000 21:40:29 +0000 Subject: [PATCH] only use a cursor when needed, from Derrick J Brashear git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8563 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hdb/db3.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/hdb/db3.c b/lib/hdb/db3.c index a5921744a..9f05eb2bf 100644 --- a/lib/hdb/db3.c +++ b/lib/hdb/db3.c @@ -40,6 +40,9 @@ static krb5_error_code DB_close(krb5_context context, HDB *db) { DB *d = (DB*)db->db; + DBC *dbcp = (DBC*)db->dbc; + if (dbcp) + dbcp->c_close(dbcp); d->close(d, 0); return 0; } @@ -90,7 +93,8 @@ DB_seq(krb5_context context, HDB *db, memset(&value, 0, sizeof(DBT)); if (db->lock(context, db, HDB_RLOCK)) return HDB_ERR_DB_INUSE; - code = d->cursor(d, NULL, (DBC **)&db->dbc, 0); + if (!db->dbc) + code = d->cursor(d, NULL, (DBC **)&db->dbc, 0); if (code) return code; dbcp=db->dbc;