BUG/MINOR: arg: don't try to add an argument on failed memory allocation

Take care of arg_list_clone() returning NULL in arg_list_add() since
the former does it too. It's only used during parsing so the impact
is very low.

Can be backported to 1.7, 1.6 and 1.5.
This commit is contained in:
Willy Tarreau 2017-04-12 22:28:52 +02:00
parent 1822e8c356
commit a9e2e4b899

View File

@ -72,9 +72,11 @@ struct arg_list *arg_list_add(struct arg_list *orig, struct arg *arg, int pos)
struct arg_list *new;
new = arg_list_clone(orig);
new->arg = arg;
new->arg_pos = pos;
LIST_ADDQ(&orig->list, &new->list);
if (new) {
new->arg = arg;
new->arg_pos = pos;
LIST_ADDQ(&orig->list, &new->list);
}
return new;
}