BUG/MINOR: cfgparse-tcp: 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:
Ilia Shipitsin 2024-12-27 21:55:38 +01:00 committed by Willy Tarreau
parent beca953c55
commit bbd1cedefc

View File

@ -144,6 +144,10 @@ static int bind_parse_interface(char **args, int cur_arg, struct proxy *px, stru
ha_free(&conf->settings.interface);
conf->settings.interface = strdup(args[cur_arg + 1]);
if (!conf->settings.interface) {
memprintf(err, "'%s %s' : out of memory", args[cur_arg], args[cur_arg + 1]);
return ERR_ALERT | ERR_FATAL;
}
return 0;
}
#endif