diff options
author | Richard Basch <probe@mit.edu> | 1997-02-20 06:15:20 +0000 |
---|---|---|
committer | Richard Basch <probe@mit.edu> | 1997-02-20 06:15:20 +0000 |
commit | 2f8402b36e9f685d84d92aff64d3070abe98a24c (patch) | |
tree | a8b556f065d2511a8d77796b37e8f8351daeb01a /src/kadmin/v5passwdd | |
parent | 4f5b47882d491005e01ed8c21dff27deebe95ca0 (diff) | |
download | krb5-2f8402b36e9f685d84d92aff64d3070abe98a24c.tar.gz krb5-2f8402b36e9f685d84d92aff64d3070abe98a24c.tar.xz krb5-2f8402b36e9f685d84d92aff64d3070abe98a24c.zip |
Removed unneeded call to krb5_init_ets
Check the return value of krb5_init_context.
Re-arranged some of the code so that all resources are freed if there
is an error.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9924 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/kadmin/v5passwdd')
-rw-r--r-- | src/kadmin/v5passwdd/kpasswd.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/kadmin/v5passwdd/kpasswd.c b/src/kadmin/v5passwdd/kpasswd.c index 0254b52075..327c081a34 100644 --- a/src/kadmin/v5passwdd/kpasswd.c +++ b/src/kadmin/v5passwdd/kpasswd.c @@ -241,25 +241,30 @@ main(argc, argv) return(error); } + /* + * Initialize Kerberos + */ + kret = krb5_init_context(&kcontext); + if (kret) { + com_err(argv[0], kret, "while initializing krb5"); + exit(1); + } + /* Get space for passwords */ if ( ((npassword = (char *) malloc(KRB5_ADM_MAX_PASSWORD_LEN)) == (char *) NULL) || ((opassword = (char *) malloc(KRB5_ADM_MAX_PASSWORD_LEN)) - == (char *) NULL)) { + == (char *) NULL)) + { fprintf(stderr, kpwd_no_memory_fmt, argv[0], KRB5_ADM_MAX_PASSWORD_LEN, kpwd_password_text); if (npassword) free(npassword); + krb5_free_context(kcontext); return(ENOMEM); } - /* - * Initialize Kerberos - */ - krb5_init_context(&kcontext); - krb5_init_ets(kcontext); - /* From now on, all error legs via 'goto cleanup' */ if (name) { |