krb5 commit: Clean up context after failed open in libkdb5
Greg Hudson
ghudson at mit.edu
Mon Jun 28 12:30:48 EDT 2021
https://github.com/krb5/krb5/commit/849b7056e703bd3724d909263769ce190db59acc
commit 849b7056e703bd3724d909263769ce190db59acc
Author: Greg Hudson <ghudson at mit.edu>
Date: Wed Jun 23 16:57:39 2021 -0400
Clean up context after failed open in libkdb5
If krb5_db_open() or krb5_db_create() fails, release the dal_handle,
as the caller is unlikely to call krb5_db_close() after a failure.
src/lib/kdb/kdb5.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/lib/kdb/kdb5.c b/src/lib/kdb/kdb5.c
index 47e9b31..11e2430 100644
--- a/src/lib/kdb/kdb5.c
+++ b/src/lib/kdb/kdb5.c
@@ -675,6 +675,8 @@ krb5_db_open(krb5_context kcontext, char **db_args, int mode)
return status;
status = v->init_module(kcontext, section, db_args, mode);
free(section);
+ if (status)
+ (void)krb5_db_fini(kcontext);
return status;
}
@@ -702,6 +704,8 @@ krb5_db_create(krb5_context kcontext, char **db_args)
return status;
status = v->create(kcontext, section, db_args);
free(section);
+ if (status)
+ (void)krb5_db_fini(kcontext);
return status;
}
More information about the cvs-krb5
mailing list