lib/hx509: hx509_request_get_san handle strpool on error

_hx509_unparse_utf8_string_name() and
_hx509_unparse_KRB5PrincipalName() can return a strpool even if
they fail.  The strpool must be passed through rk_strpoolcollect()
in order to return the contents to the caller of
hx509_request_get_san().

Change-Id: Ifda5620f4e9e00ca188aa138f692fccc12621ae8
This commit is contained in:
Jeffrey Altman
2022-01-16 21:36:28 -05:00
parent 708d9b4042
commit c59dd0b36c

View File

@@ -1366,8 +1366,7 @@ hx509_request_get_san(hx509_request req,
ret = _hx509_unparse_utf8_string_name(req->context, &pool,
&san->u.otherName.value);
if (ret == 0 &&
(*out = rk_strpoolcollect(pool)) == NULL)
if ((*out = rk_strpoolcollect(pool)) == NULL)
return hx509_enomem(req->context);
return ret;
}
@@ -1376,8 +1375,7 @@ hx509_request_get_san(hx509_request req,
ret = _hx509_unparse_KRB5PrincipalName(req->context, &pool,
&san->u.otherName.value);
if (ret == 0 &&
(*out = rk_strpoolcollect(pool)) == NULL)
if ((*out = rk_strpoolcollect(pool)) == NULL)
return hx509_enomem(req->context);
return 0;
}