From c59dd0b36c15aa173af7795adba401c4076e4acc Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 16 Jan 2022 21:36:28 -0500 Subject: [PATCH] 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 --- lib/hx509/req.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/hx509/req.c b/lib/hx509/req.c index 2c3fbc88d..64eb543a1 100644 --- a/lib/hx509/req.c +++ b/lib/hx509/req.c @@ -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; } -- 2.11.4.GIT