From: Greg Hudson Date: Thu, 14 Jun 2018 14:52:33 +0000 (-0400) Subject: Fix minor leak in krb5_get_fallback_host_realm() X-Git-Tag: krb5-1.17-beta1~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80ea4fe833c72e3be47509a3216eee726c5fdb26;p=thirdparty%2Fkrb5.git 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 --- diff --git a/src/lib/krb5/os/hostrealm_domain.c b/src/lib/krb5/os/hostrealm_domain.c index 2228df0627..c3d31c7031 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);