lib/hx509: _hx509_cert_to_env free 'buf'

The output buffer returned from hx509_name_to_string() must be
freed before it is overwritten by another call to
hx509_name_to_string().

Change-Id: Iaf28b14a2712cd28085ac5452819818e739d43ed
This commit is contained in:
Jeffrey Altman
2022-01-16 21:59:49 -05:00
parent 1a793c04fa
commit 603ee4d65d

View File

@@ -3706,13 +3706,12 @@ _hx509_cert_to_env(hx509_context context, hx509_cert cert, hx509_env *env)
goto out;
ret = hx509_name_to_string(name, &buf);
if (ret) {
hx509_name_free(&name);
hx509_name_free(&name);
if (ret)
goto out;
}
ret = hx509_env_add(context, &envcert, "subject", buf);
hx509_name_free(&name);
hx509_xfree(buf);
if (ret)
goto out;