commit 07ba1f811fff7147228f2e5e1189c82ba2ed0ca6
Author: tlyu <tlyu@dc483132-0cff-0310-8789-dd5450dbe970>
Date: Wed May 19 18:52:49 2010 +0000
ticket: 6722
version_fixed: 1.8.2
status: resolved
pull up r24020 from trunk
------------------------------------------------------------------------
r24020 | ghudson | 2010-05-13 14:49:20 -0400 (Thu, 13 May 2010) | 8 lines
ticket: 6722
subject: Error handling bug in krb5_init_creds_init()
tags: pullup
target_version: 1.8.2
Fix a bug in krb5_init_creds_init() where a freed context could be
returned to the caller in certain error cases.
git-svn-id:
svn://anonsvn.mit.edu/krb5/branches/krb5-1-8@24062
dc483132-0cff-0310-8789-dd5450dbe970
src/lib/krb5/krb/get_in_tkt.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/lib/krb5/krb/get_in_tkt.c b/src/lib/krb5/krb/get_in_tkt.c
index b1b837d..41059af 100644
--- a/src/lib/krb5/krb/get_in_tkt.c
+++ b/src/lib/krb5/krb/get_in_tkt.c
@@ -1489,14 +1489,15 @@ krb5_init_creds_init(krb5_context context,
krb5_princ_type(context, ctx->request->client) = KRB5_NT_WELLKNOWN;
}
code = restart_init_creds_loop(context, ctx, NULL);
+ if (code)
+ goto cleanup;
*pctx = ctx;
+ ctx = NULL;
cleanup:
- if (code != 0)
- krb5_init_creds_free(context, ctx);
- if (str != NULL)
- free(str);
+ krb5_init_creds_free(context, ctx);
+ free(str);
return code;
}