diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-21 17:35:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-21 17:35:01 -0500 |
commit | 5978bdd05fed013d301f6d8b089c7c7ea8c0ef8e (patch) | |
tree | 676c5bd2a479a80cbce71ba02c1ada8883989540 /src/basic/strv.c | |
parent | a3d8d68cc1698d014575f0f66c58e253bd46c240 (diff) | |
parent | bcab914f7fb0570eb728907163ada55c6ae3d602 (diff) |
Merge pull request #5411 from poettering/various-pre-v233-fixes
Various pre v233 fixes.
Diffstat (limited to 'src/basic/strv.c')
-rw-r--r-- | src/basic/strv.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c index 60f92e6373..0eec868eed 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -564,6 +564,9 @@ int strv_extend_front(char ***l, const char *value) { /* Like strv_extend(), but prepends rather than appends the new entry */ + if (!value) + return 0; + n = strv_length(*l); /* Increase and overflow check. */ @@ -571,12 +574,9 @@ int strv_extend_front(char ***l, const char *value) { if (m < n) return -ENOMEM; - if (value) { - v = strdup(value); - if (!v) - return -ENOMEM; - } else - v = NULL; + v = strdup(value); + if (!v) + return -ENOMEM; c = realloc_multiply(*l, sizeof(char*), m); if (!c) { |