diff options
Diffstat (limited to 'src/strv.c')
-rw-r--r-- | src/strv.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/strv.c b/src/strv.c index 640ae3f0a3..bb309d9f92 100644 --- a/src/strv.c +++ b/src/strv.c @@ -67,7 +67,8 @@ void strv_free(char **l) { char **strv_copy(char **l) { char **r, **k; - if (!(k = r = new(char*, strv_length(l)+1))) + k = r = new(char*, strv_length(l)+1); + if (!k) return NULL; if (l) @@ -198,7 +199,8 @@ char **strv_merge_concat(char **a, char **b, const char *suffix) { if (!b) return strv_copy(a); - if (!(r = new(char*, strv_length(a)+strv_length(b)+1))) + r = new(char*, strv_length(a) + strv_length(b) + 1); + if (!r) return NULL; k = r; @@ -324,7 +326,8 @@ char **strv_append(char **l, const char *s) { if (!s) return strv_copy(l); - if (!(r = new(char*, strv_length(l)+2))) + r = new(char*, strv_length(l)+2); + if (!r) return NULL; for (k = r; *l; k++, l++) |