From: Willy Tarreau Date: Wed, 12 Apr 2017 20:28:52 +0000 (+0200) Subject: BUG/MINOR: arg: don't try to add an argument on failed memory allocation X-Git-Tag: v1.8-dev2~89 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a9e2e4b89922384755ac6a0fb4c24a1b159d43f2;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/arg.c b/src/arg.c index 9e551fb8e0..ca914faa9c 100644 --- a/src/arg.c +++ b/src/arg.c @@ -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; }