From d6560fb1ed6fce883dfadecfdc734500d0d2c284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Thu, 23 Jun 2005 13:41:08 +0000 Subject: [PATCH] (DB_open): in case of error, close database git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15510 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hdb/db3.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/hdb/db3.c b/lib/hdb/db3.c index d9ee2b15f..860c15041 100644 --- a/lib/hdb/db3.c +++ b/lib/hdb/db3.c @@ -299,6 +299,14 @@ DB_open(krb5_context context, HDB *db, int flags, mode_t mode) ret = hdb_init_db(context, db); if(ret == HDB_ERR_NOENTRY) return 0; + if (ret) { + DB_close(context, db); + krb5_set_error_string(context, "hdb_open: failed %s database %s", + (flags & O_ACCMODE) == O_RDONLY ? + "checking format of" : "initialize", + db->hdb_name); + } + return ret; }