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 9e551fb..ca914fa 100644
--- a/src/arg.c
+++ b/src/arg.c
@@ -72,9 +72,11 @@
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;
}