lib/krb5: fallback_get_hosts free addrinfo if gTLD collision or error
If getaddrinfo() succeeds and returns the gTLD name collision address the result is ignored but the allocated addrinfo was not freed. If allocation of the krb5_krbhst_info structure fails the addrinfo would also be leaked. Change-Id: I94111e081cba9548f57ad7b7e7cbea3faab7502c
This commit is contained in:
@@ -562,6 +562,7 @@ fallback_get_hosts(krb5_context context, struct krb5_krbhst_data *kd,
|
||||
"Realm %s needs immediate attention "
|
||||
"see https://icann.org/namecollision",
|
||||
kd->realm);
|
||||
freeaddrinfo(ai);
|
||||
return KRB5_KDC_UNREACH;
|
||||
}
|
||||
}
|
||||
@@ -570,6 +571,7 @@ fallback_get_hosts(krb5_context context, struct krb5_krbhst_data *kd,
|
||||
hi = calloc(1, sizeof(*hi) + hostlen);
|
||||
if(hi == NULL) {
|
||||
free(host);
|
||||
freeaddrinfo(ai);
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user