From: Ilia Shipitsin Date: Mon, 23 Dec 2024 21:01:22 +0000 (+0100) Subject: BUG/MINOR: debug: handle a possible strdup() failure X-Git-Tag: v3.2-dev2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6524fbfb70427ebfaa03cd512d726f530eb1369a;p=thirdparty%2Fhaproxy.git 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. --- 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; }