From 6524fbfb70427ebfaa03cd512d726f530eb1369a Mon Sep 17 00:00:00 2001 From: Ilia Shipitsin Date: Mon, 23 Dec 2024 22:01:22 +0100 Subject: [PATCH] BUG/MINOR: debug: handle a possible strdup() failure This defect was found by the coccinelle script "unchecked-strdup.cocci". It can be backported to all supported branches. --- src/debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/debug.c b/src/debug.c index 2987d36ef0..3b15007b88 100644 --- a/src/debug.c +++ b/src/debug.c @@ -2048,6 +2048,8 @@ static int debug_parse_cli_memstats(char **args, char *payload, struct appctx *a else if (strcmp(args[arg], "match") == 0 && *args[arg + 1]) { ha_free(&ctx->match); ctx->match = strdup(args[arg + 1]); + if (!ctx->match) + return cli_err(appctx, "Out of memory.\n"); arg++; continue; } -- 2.47.3