From 69892375d8bd25d12d0418d2d941ecc74ce46019 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Mon, 19 Nov 2001 18:39:32 +0000 Subject: [PATCH] * kdb5_mkdums.c (main): Invoke krb5_free_context when finished. (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 | 5 +++++ src/tests/create/kdb5_mkdums.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/tests/create/ChangeLog b/src/tests/create/ChangeLog index e8817cb60..c9e18d510 100644 --- a/src/tests/create/ChangeLog +++ b/src/tests/create/ChangeLog @@ -1,3 +1,8 @@ +2001-11-19 Ezra Peisach + + * 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 * kdb5_mkdums.c: Make prototypes unconditional. diff --git a/src/tests/create/kdb5_mkdums.c b/src/tests/create/kdb5_mkdums.c index 50f2c9bf0..327539580 100644 --- a/src/tests/create/kdb5_mkdums.c +++ b/src/tests/create/kdb5_mkdums.c @@ -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, -- 2.26.2