(DB_destroy): clear master key

(DB_open): check malloc


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5760 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1999-03-25 03:38:56 +00:00
parent 530c75890d
commit 2974b8e4cc

View File

@@ -53,9 +53,12 @@ DB_close(krb5_context context, HDB *db)
static krb5_error_code static krb5_error_code
DB_destroy(krb5_context context, HDB *db) DB_destroy(krb5_context context, HDB *db)
{ {
krb5_error_code ret;
ret = hdb_clear_master_key (context, db);
free(db->name); free(db->name);
free(db); free(db);
return 0; return ret;
} }
static krb5_error_code static krb5_error_code
@@ -219,6 +222,8 @@ DB_open(krb5_context context, HDB *db, int flags, mode_t mode)
krb5_error_code ret; krb5_error_code ret;
asprintf(&fn, "%s.db", db->name); asprintf(&fn, "%s.db", db->name);
if (fn == NULL)
return ENOMEM;
db->db = dbopen(fn, flags, mode, DB_BTREE, NULL); db->db = dbopen(fn, flags, mode, DB_BTREE, NULL);
free(fn); free(fn);
/* try to open without .db extension */ /* try to open without .db extension */