krb5_xfree cleanup
authorRichard Basch <probe@mit.edu>
Wed, 19 Feb 1997 01:00:22 +0000 (01:00 +0000)
committerRichard Basch <probe@mit.edu>
Wed, 19 Feb 1997 01:00:22 +0000 (01:00 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9906 dc483132-0cff-0310-8789-dd5450dbe970

src/kadmin/dbutil/kdb5_util.c
src/kadmin/ktutil/ktutil_funcs.c
src/kadmin/v5passwdd/kpasswd.c
src/kadmin/v5passwdd/proto_serv.c
src/kdc/do_as_req.c

index 5f4a0dfbfd23376746e62ce4a27e19c9ebdce759..38a2c021a9d1498833b45453df5cb2830628ddbf 100644 (file)
@@ -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);
     }
 
index 5215fd815a9a530b5c622f9ed9865e099dbfb070..64b7272fc26b6828e206b55c7913b59ee4d7100a 100644 (file)
@@ -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;
 }
index f030b8e622c0674fce0be619ae43280ea746855f..0254b520758d0872b401d2032f9a25dd1e47e0ab 100644 (file)
@@ -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);
 }
index d87a71a64432601445fe6f08e99fb0cf286b5cc7..bda5e3660d015273c70f015c21e194771cea6f0d 100644 (file)
@@ -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)
index d28a6b69ee36447dca478f660988857f535b5731..504f0077a51e6d3ebdb3e4d87f353000c646f94e 100644 (file)
@@ -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;
 }