krb5 commit: Fix minor leak in krb5_get_fallback_host_realm()

Greg Hudson <[email protected]>
Newsgroups gmane.comp.encryption.kerberos.cvs
Message-ID <[email protected]>
https://github.com/krb5/krb5/commit/80ea4fe833c72e3be47509a3216eee726c5fdb26
commit 80ea4fe833c72e3be47509a3216eee726c5fdb26
Author: Greg Hudson <[email protected]>
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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.