]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: acme: fix task allocation leaked upon error
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 27 Mar 2026 15:56:47 +0000 (16:56 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 27 Mar 2026 15:58:49 +0000 (16:58 +0100)
Fix a leak of the task object in acme_start_task() when one of the
condition in the function failed.

Fix issue #3308.

Must be backported to 3.2 and later.

src/acme.c

index 44b0d79956c0328cb5f9b74acc05b81bd4ff739c..fe915d6aea3d3350db0b7f7b69eb05b5a1a63cbd 100644 (file)
@@ -2667,7 +2667,7 @@ EVP_PKEY *acme_gen_tmp_pkey()
 /* start an ACME task */
 static int acme_start_task(struct ckch_store *store, char **errmsg)
 {
-       struct task *task;
+       struct task *task = NULL;
        struct acme_ctx *ctx = NULL;
        struct acme_cfg *cfg;
        struct ckch_store *newstore = NULL;
@@ -2752,6 +2752,8 @@ err:
                HA_RWLOCK_WRUNLOCK(OTHER_LOCK, &acme_lock);
                acme_ctx_destroy(ctx);
        }
+       if (task)
+               task_destroy(task);
        memprintf(errmsg, "%sCan't start the ACME client.", *errmsg ? *errmsg : "");
        return 1;
 }