BUG/MINOR: acme: free() DER buffer on a2base64url error path

In acme_req_finalize() the data buffer is only freed when a2base64url
succeed. This patch moves the allocation so it free() the DER buffer in
every cases.

Must be backported to 3.2 and later.
This commit is contained in:
William Lallemand 2026-03-23 14:02:48 +01:00
parent 52d8ee85e7
commit efbf0f8ed1

View File

@ -1343,7 +1343,6 @@ int acme_req_finalize(struct task *task, struct acme_ctx *ctx, char **errmsg)
csr->data = ret;
chunk_printf(req_in, "{ \"csr\": \"%.*s\" }", (int)csr->data, csr->area);
OPENSSL_free(data);
if (acme_jws_payload(req_in, ctx->nonce, ctx->finalize, ctx->cfg->account.pkey, ctx->kid, req_out, errmsg) != 0)
@ -1357,6 +1356,7 @@ int acme_req_finalize(struct task *task, struct acme_ctx *ctx, char **errmsg)
error:
memprintf(errmsg, "couldn't request the finalize URL");
out:
OPENSSL_free(data);
free_trash_chunk(req_in);
free_trash_chunk(req_out);
free_trash_chunk(csr);