* kdb5_mkdums.c (main): Invoke krb5_free_context when finished.
authorEzra Peisach <epeisach@mit.edu>
Mon, 19 Nov 2001 18:39:32 +0000 (18:39 +0000)
committerEzra Peisach <epeisach@mit.edu>
Mon, 19 Nov 2001 18:39:32 +0000 (18:39 +0000)
(add_princ): Use krb5_free_principal to prevent memory leak.

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

src/tests/create/ChangeLog
src/tests/create/kdb5_mkdums.c

index e8817cb60fe2632a9155ed5c5c54e9e8ea4f2bf6..c9e18d510f8fd4bc9967f125aa2529ba97201a37 100644 (file)
@@ -1,3 +1,8 @@
+2001-11-19  Ezra Peisach  <epeisach@mit.edu>
+
+       * kdb5_mkdums.c (main): Invoke krb5_free_context when finished. 
+       (add_princ): Use krb5_free_principal to prevent memory leak.
+
 2001-10-09  Ken Raeburn  <raeburn@mit.edu>
 
        * kdb5_mkdums.c: Make prototypes unconditional.
index 50f2c9bf0f279d5a9dad5d02d9bca34b318d5855..32753958044195c9712669be3e08e6784f2f7984 100644 (file)
@@ -203,6 +203,7 @@ char *argv[];
        com_err(progname, retval, "while closing database");
        exit(1);
     }
+    krb5_free_context(test_context);
     exit(0);
 }
 
@@ -235,6 +236,7 @@ add_princ(context, str_newprinc)
     if ((retval = krb5_copy_principal(context, newprinc, &newentry.princ))) {
        com_err(progname, retval, "while encoding princ to db entry for '%s'", 
                princ_name);
+       krb5_free_principal(context, newprinc);
        goto error;
     }
 
@@ -245,12 +247,14 @@ add_princ(context, str_newprinc)
        retval = krb5_timeofday(context, &now);
        if (retval) {
            com_err(progname, retval, "while fetching date");
+           krb5_free_principal(context, newprinc);
            goto error;
        }
        retval = krb5_dbe_update_mod_princ_data(context, &newentry, now,
                                               master_princ);
        if (retval) {
            com_err(progname, retval, "while encoding mod_princ data");
+           krb5_free_principal(context, newprinc);
            goto error;
        }
     }
@@ -262,9 +266,12 @@ add_princ(context, str_newprinc)
         if ((retval = krb5_principal2salt(context, newprinc, &salt))) {
            com_err(progname, retval, "while converting princ to salt for '%s'",
                    princ_name);
+           krb5_free_principal(context, newprinc);
            goto error;
         }
 
+       krb5_free_principal(context, newprinc);
+
        pwd.length = strlen(princ_name);
        pwd.data = princ_name;  /* must be able to regenerate */
        if ((retval = krb5_c_string_to_key(context, master_keyblock.enctype,