This defect was found by the coccinelle script "unchecked-strdup.cocci".
It can be backported to all supported branches.
return ERR_ALERT | ERR_FATAL;
}
- list_for_each_entry(l, &conf->listeners, by_bind)
+ list_for_each_entry(l, &conf->listeners, by_bind) {
l->name = strdup(args[cur_arg + 1]);
+ if (!l->name) {
+ memprintf(err, "'%s %s' : out of memory", args[cur_arg], args[cur_arg + 1]);
+ return ERR_ALERT | ERR_FATAL;
+ }
+ }
return 0;
}