]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix minor leak in krb5_get_fallback_host_realm() 791/head
authorGreg Hudson <ghudson@mit.edu>
Thu, 14 Jun 2018 14:52:33 +0000 (10:52 -0400)
committerGreg Hudson <ghudson@mit.edu>
Fri, 15 Jun 2018 14:53:33 +0000 (10:53 -0400)
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

index 2228df062752283eb417ba90673488666bac34e5..c3d31c7031539def96213e0a5b7c07f31403e88c 100644 (file)
@@ -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);