mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
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.
This commit is contained in:
parent
a3e6c783cd
commit
6524fbfb70
@ -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]) {
|
else if (strcmp(args[arg], "match") == 0 && *args[arg + 1]) {
|
||||||
ha_free(&ctx->match);
|
ha_free(&ctx->match);
|
||||||
ctx->match = strdup(args[arg + 1]);
|
ctx->match = strdup(args[arg + 1]);
|
||||||
|
if (!ctx->match)
|
||||||
|
return cli_err(appctx, "Out of memory.\n");
|
||||||
arg++;
|
arg++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user