From: Ilia Shipitsin Date: Fri, 27 Dec 2024 20:55:07 +0000 (+0100) Subject: BUG/MINOR: pool: handle a possible strdup() failure X-Git-Tag: v3.2-dev3~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=beca953c559f4f49c7cf1df0239ae7d747213248;p=thirdparty%2Fhaproxy.git BUG/MINOR: pool: 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/pool.c b/src/pool.c index f4a4af1005..d653ac3c91 100644 --- a/src/pool.c +++ b/src/pool.c @@ -1373,6 +1373,8 @@ static int cli_parse_show_pools(char **args, char *payload, struct appctx *appct } else if (strcmp(args[arg], "match") == 0 && *args[arg+1]) { ctx->prefix = strdup(args[arg+1]); // only pools starting with this + if (!ctx->prefix) + return cli_err(appctx, "Out of memory.\n"); arg++; } else if (isdigit((unsigned char)*args[arg])) {