From: Olivier Houchard Date: Tue, 17 Nov 2026 09:56:32 +0000 (+0100) Subject: BUG/MINOR: debug: Do not allocate context when we don't need one X-Git-Tag: v3.5-dev13~50 X-Git-Url: https://git.kaiwu.me/http/%7B@url%7D?a=commitdiff_plain;h=e6c0c0e639fc9ce7b7044c93266b97b435729ced;p=haproxy.git BUG/MINOR: debug: Do not allocate context when we don't need one In debug_parse_cli_sched(), when debug dev sched has been used with a count of 0, do not bother allocating a context, as it will never be used, and the memory will be leaked. This is a minor problem that only affects a debug command used incorrectly, and do not need any backport. This was submitted by Alexandre Laroche, and should fix github issue --- diff --git a/src/debug.c b/src/debug.c index 553ffe2d4..09f09de0a 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1955,6 +1955,9 @@ static int debug_parse_cli_sched(char **args, char *payload, struct appctx *appc *(uint8_t *)ptr = new; } + if (count == 0) + return cli_err(appctx, "count must be at least 1.\n"); + tctx = calloc(count + 2, sizeof(*tctx)); if (!tctx) goto fail;