krb5 commit: Fix minor leak in krb5_get_fallback_host_realm()

Greg Hudson ghudson at mit.edu
Fri Jun 15 11:08:14 EDT 2018


https://github.com/krb5/krb5/commit/80ea4fe833c72e3be47509a3216eee726c5fdb26
commit 80ea4fe833c72e3be47509a3216eee726c5fdb26
Author: Greg Hudson <ghudson at mit.edu>
Date:   Thu Jun 14 10:52:33 2018 -0400

    Fix minor leak in krb5_get_fallback_host_realm()
    
    In domain_fallback_realm(), if profile_get_integer() fails, uhost is
    leaked.  Fix this bug by using the cleanup handler instead of
    returning immediately.  Reported by Bean Zhang.
    
    ticket: 8693

 src/lib/krb5/os/hostrealm_domain.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/lib/krb5/os/hostrealm_domain.c b/src/lib/krb5/os/hostrealm_domain.c
index 2228df0..c3d31c7 100644
--- a/src/lib/krb5/os/hostrealm_domain.c
+++ b/src/lib/krb5/os/hostrealm_domain.c
@@ -81,7 +81,7 @@ domain_fallback_realm(krb5_context context, krb5_hostrealm_moddata data,
     ret = profile_get_integer(context->profile, KRB5_CONF_LIBDEFAULTS,
                               KRB5_CONF_REALM_TRY_DOMAINS, 0, -1, &limit);
     if (ret)
-        return ret;
+        goto cleanup;
     suffix = uhost;
     while (limit-- >= 0 && (dot = strchr(suffix, '.')) != NULL) {
         drealm = string2data((char *)suffix);


More information about the cvs-krb5 mailing list