From 5caa3b093619c89f0ea6ff50c2cd5b8e9469502c Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Fri, 17 Sep 2010 15:52:23 +0000 Subject: [PATCH] In kinit_kdb_init(), ensure that we don't return an error with the old, freed value of *pcontext still there--that would result in a double free. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24326 dc483132-0cff-0310-8789-dd5450dbe970 --- src/clients/kinit/kinit_kdb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/clients/kinit/kinit_kdb.c b/src/clients/kinit/kinit_kdb.c index f2011a6bf..7a2c2b446 100644 --- a/src/clients/kinit/kinit_kdb.c +++ b/src/clients/kinit/kinit_kdb.c @@ -52,8 +52,10 @@ kinit_kdb_init(krb5_context *pcontext, char *realm) kadm5_config_params config; krb5_error_code retval = 0; - if (*pcontext) + if (*pcontext) { krb5_free_context(*pcontext); + *pcontext = NULL; + } memset(&config, 0, sizeof config); retval = kadm5_init_krb5_context(pcontext); if (retval) -- 2.26.2