chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
strv: handle empty lists in strv_copy() properly
[elogind.git]
/
src
/
strv.c
diff --git
a/src/strv.c
b/src/strv.c
index c5f8df06da6e8325b36dbbe0dec5b5dc54910fe4..c8ebb648d643e9f43667d77ad00c7850e638cefa 100644
(file)
--- a/
src/strv.c
+++ b/
src/strv.c
@@
-70,9
+70,10
@@
char **strv_copy(char **l) {
if (!(r = new(char*, strv_length(l)+1)))
return NULL;
- for (k = r; *l; k++, l++)
- if (!(*k = strdup(*l)))
- goto fail;
+ if (l)
+ for (k = r; *l; k++, l++)
+ if (!(*k = strdup(*l)))
+ goto fail;
*k = NULL;
return r;