* kdb5_verify.c (main): Use krb5_free_unparsed_name() to free up
authorEzra Peisach <epeisach@mit.edu>
Mon, 19 Nov 2001 18:41:24 +0000 (18:41 +0000)
committerEzra Peisach <epeisach@mit.edu>
Mon, 19 Nov 2001 18:41:24 +0000 (18:41 +0000)
memory.
(check_princ): Use krb5_free_data_contents() and
krb5_free_principal() to cleanup memory leak.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13996 dc483132-0cff-0310-8789-dd5450dbe970

src/tests/verify/ChangeLog
src/tests/verify/kdb5_verify.c

index c12b37dc0db5263f6b7229aad89fc719f1dc9668..39c3982c2154d93f1a6be61bd782eadb28fea459 100644 (file)
@@ -1,3 +1,10 @@
+2001-11-19  Ezra Peisach  <epeisach@mit.edu>
+
+       * kdb5_verify.c (main): Use krb5_free_unparsed_name() to free up
+       memory.
+       (check_princ): Use krb5_free_data_contents() and
+       krb5_free_principal() to cleanup memory leak.
+
 2001-10-09  Ken Raeburn  <raeburn@mit.edu>
 
        * kdb5_verify.c: Make prototypes unconditional.
index f15abaa5e600388c295f86a2d6cfef500a334e75..1127c7fda09b516d4da0510286fe9bd9556da78e 100644 (file)
@@ -209,6 +209,11 @@ char *argv[];
        com_err(progname, retval, "while closing database");
        exit(1);
     }
+
+    if (str_master_princ) {
+       krb5_free_unparsed_name(context, str_master_princ);
+    }
+    krb5_free_context(context);
     exit(0);
 }
 
@@ -241,6 +246,7 @@ check_princ(context, str_princ)
 
     if ((retval = krb5_principal2salt(context, princ, &salt))) {
        com_err(progname, retval, "while converting principal to salt for '%s'", princ_name);
+       krb5_free_principal(context, princ);
        goto out;
     }
 
@@ -248,14 +254,19 @@ check_princ(context, str_princ)
                                    &pwd_key, &pwd, &salt))) {
        com_err(progname, retval, "while converting password to key for '%s'", 
                princ_name);
+       krb5_free_data_contents(context, &salt);
+       krb5_free_principal(context, princ);
        goto out;
     }
+    krb5_free_data_contents(context, &salt);
 
     if ((retval = krb5_db_get_principal(context, princ, &kdbe, 
                                        &nprincs, &more))) {
       com_err(progname, retval, "while attempting to verify principal's existence");
+      krb5_free_principal(context, princ);
       goto out;
     }
+    krb5_free_principal(context, princ);
 
     if (nprincs != 1) {
       com_err(progname, 0, "Found %d entries db entry for %s.\n", nprincs,