From d1810074391d0e3dfae9df15e715c25425e606cd Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Tue, 26 Sep 2000 17:01:58 +0000 Subject: [PATCH] * conv_princ.c (krb5_425_conv_principal): Call profile_free_list on v4realms during the iteration loop. Do not call profile_release_string with a NULL pointer. Fixes a memory leak. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12678 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/ChangeLog | 6 ++++++ src/lib/krb5/krb/conv_princ.c | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index 014042b1c..b6a5bc4ae 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,9 @@ +Tue Sep 26 13:00:54 2000 Ezra Peisach + + * conv_princ.c (krb5_425_conv_principal): Call profile_free_list + on v4realms during the iteration loop. Do not call + profile_release_string with a NULL pointer. + 2000-09-25 Ezra Peisach * t_kerb.c: Add prototypes for test functions. diff --git a/src/lib/krb5/krb/conv_princ.c b/src/lib/krb5/krb/conv_princ.c index f0d3d3d31..c880de3eb 100644 --- a/src/lib/krb5/krb/conv_princ.c +++ b/src/lib/krb5/krb/conv_princ.c @@ -272,6 +272,10 @@ krb5_425_conv_principal(context, name, instance, realm, princ) } else if ((retval == 0) && (realm_name == NULL)) { break; } + if (v4realms != NULL) { + profile_free_list(v4realms); + v4realms = NULL; + } if (realm_name != NULL) { profile_release_string (realm_name); realm_name = NULL; @@ -327,10 +331,10 @@ krb5_425_conv_principal(context, name, instance, realm, princ) not_service: retval = krb5_build_principal(context, princ, strlen(realm), realm, name, instance, 0); - profile_iterator_free (&iterator); - profile_free_list(full_name); - profile_free_list(v4realms); - profile_release_string (realm_name); - profile_release_string (dummy_value); + if (iterator) profile_iterator_free (&iterator); + if (full_name) profile_free_list(full_name); + if (v4realms) profile_free_list(v4realms); + if (realm_name) profile_release_string (realm_name); + if (dummy_value) profile_release_string (dummy_value); return retval; } -- 2.26.2