From: Richard Basch Date: Wed, 19 Feb 1997 01:00:22 +0000 (+0000) Subject: krb5_xfree cleanup X-Git-Tag: krb5-1.1-beta1~1285 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=70674c3a5f7857281c54c4d2edb9d7975581b9b0;p=krb5.git krb5_xfree cleanup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9906 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/dbutil/kdb5_util.c b/src/kadmin/dbutil/kdb5_util.c index 5f4a0dfbf..38a2c021a 100644 --- a/src/kadmin/dbutil/kdb5_util.c +++ b/src/kadmin/dbutil/kdb5_util.c @@ -254,9 +254,7 @@ void set_dbname(argc, argv) (void) krb5_finish_key(util_context, &master_encblock); (void) krb5_finish_random_key(util_context, &master_encblock, &master_random); - memset((char *)master_keyblock.contents, 0, - master_keyblock.length); - krb5_xfree(master_keyblock.contents); + krb5_free_keyblock_contents(util_context, &master_keyblock); master_keyblock.contents = NULL; valid_master_key = 0; } @@ -389,8 +387,7 @@ int open_db_and_mkey() ) { com_err(progname, retval, "while verifying master key"); exit_status++; - memset((char *)master_keyblock.contents, 0, master_keyblock.length); - krb5_xfree(master_keyblock.contents); + krb5_free_keyblock_contents(util_context, &master_keyblock); return(1); } if ((retval = krb5_process_key(util_context, &master_encblock, @@ -398,7 +395,7 @@ int open_db_and_mkey() com_err(progname, retval, "while processing master key"); exit_status++; memset((char *)master_keyblock.contents, 0, master_keyblock.length); - krb5_xfree(master_keyblock.contents); + krb5_free_keyblock_contents(util_context, &master_keyblock); return(1); } if ((retval = krb5_init_random_key(util_context, &master_encblock, @@ -408,7 +405,7 @@ int open_db_and_mkey() exit_status++; (void) krb5_finish_key(util_context, &master_encblock); memset((char *)master_keyblock.contents, 0, master_keyblock.length); - krb5_xfree(master_keyblock.contents); + krb5_free_keyblock_contents(util_context, &master_keyblock); return(1); } diff --git a/src/kadmin/ktutil/ktutil_funcs.c b/src/kadmin/ktutil/ktutil_funcs.c index 5215fd815..64b7272fc 100644 --- a/src/kadmin/ktutil/ktutil_funcs.c +++ b/src/kadmin/ktutil/ktutil_funcs.c @@ -43,12 +43,12 @@ krb5_error_code ktutil_free_kt_list(context, list) for (lp = list; lp;) { retval = krb5_kt_free_entry(context, lp->entry); - krb5_xfree(lp->entry); + free((char *)lp->entry); if (retval) break; prev = lp; lp = lp->next; - krb5_xfree(prev); + free((char *)prev); } return retval; } @@ -135,7 +135,7 @@ krb5_error_code ktutil_read_keytab(context, name, list) lp->entry = entry; } if (entry) - krb5_xfree(entry); + free((char *)entry); if (retval) if (retval == KRB5_KT_END) retval = 0; @@ -286,7 +286,7 @@ krb5_error_code ktutil_read_srvtab(context, name, list) if (entry) { if (entry->magic == KV5M_KEYTAB_ENTRY) krb5_kt_free_entry(context, entry); - krb5_xfree(entry); + free((char *)entry); } if (retval) { ktutil_free_kt_list(context, tail); @@ -383,7 +383,7 @@ krb5_error_code ktutil_write_srvtab(context, list, name) for (lp = pruned; lp;) { prev = lp; lp = lp->next; - krb5_xfree(prev); + free((char *)prev); } return retval; } diff --git a/src/kadmin/v5passwdd/kpasswd.c b/src/kadmin/v5passwdd/kpasswd.c index f030b8e62..0254b5207 100644 --- a/src/kadmin/v5passwdd/kpasswd.c +++ b/src/kadmin/v5passwdd/kpasswd.c @@ -525,7 +525,7 @@ main(argc, argv) /* Clear and free password storage */ if (opassword) { memset(opassword, 0, KRB5_ADM_MAX_PASSWORD_LEN); - krb5_xfree(opassword); + free(opassword); } if (npassword) { memset(npassword, 0, KRB5_ADM_MAX_PASSWORD_LEN); @@ -577,6 +577,6 @@ main(argc, argv) done: krb5_adm_disconnect(kcontext, &conn_socket, auth_context, ccache); - krb5_xfree(kcontext); + krb5_free_context(kcontext); return(error); } diff --git a/src/kadmin/v5passwdd/proto_serv.c b/src/kadmin/v5passwdd/proto_serv.c index d87a71a64..bda5e3660 100644 --- a/src/kadmin/v5passwdd/proto_serv.c +++ b/src/kadmin/v5passwdd/proto_serv.c @@ -819,7 +819,7 @@ proto_serv(kcontext, my_id, cl_sock, sv_p, cl_p) if (!er_kret) krb5_write_message(kcontext, (krb5_pointer) &cl_sock, &errout); free(errbuf.text.data); - krb5_xfree(errout.data); + krb5_free_data_contents(kcontext, &errout); } cleanup: @@ -839,9 +839,9 @@ proto_serv(kcontext, my_id, cl_sock, sv_p, cl_p) if (num_args) krb5_free_adm_data(kcontext, num_args, arglist); if (in_data.data) - krb5_xfree(in_data.data); + krb5_free_data_contents(kcontext, &in_data); if (out_data.data) - krb5_xfree(out_data.data); + krb5_free_data_contents(kcontext, &out_data); if (local && local->contents) free(local->contents); if (remote && remote->contents) diff --git a/src/kdc/do_as_req.c b/src/kdc/do_as_req.c index d28a6b69e..504f0077a 100644 --- a/src/kdc/do_as_req.c +++ b/src/kdc/do_as_req.c @@ -468,8 +468,8 @@ errout: ticket_reply.enc_part.ciphertext.length); free(ticket_reply.enc_part.ciphertext.data); } - if (e_data.data) - krb5_xfree(e_data.data); + + krb5_free_data_contents(kdc_context, &e_data); return errcode; }