]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl/acme: free EVP_PKEY upon error
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 28 Apr 2025 14:33:48 +0000 (16:33 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 28 Apr 2025 16:20:21 +0000 (18:20 +0200)
Free the EPV_PKEY upon error when the X509_REQ generation failed.

No backport needed.

src/acme.c

index 8303458be9e0d1afcdcec282d9c645d43ed1e657..ec5a3b9023b22e5578a4be7ea988c0202f19bf15 100644 (file)
@@ -2011,6 +2011,7 @@ static int cli_acme_renew_parse(char **args, char *payload, struct appctx *appct
 
        EVP_PKEY_free(newstore->data->key);
        newstore->data->key = pkey;
+       pkey = NULL;
 
        ctx->req = acme_x509_req(pkey, store->conf.acme.domains);
        if (!ctx->req) {
@@ -2028,6 +2029,7 @@ static int cli_acme_renew_parse(char **args, char *payload, struct appctx *appct
 
 err:
        HA_SPIN_UNLOCK(CKCH_LOCK, &ckch_lock);
+       EVP_PKEY_free(pkey);
        ckch_store_free(newstore);
        EVP_PKEY_CTX_free(pkey_ctx);
        free(ctx);