diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-12 14:09:15 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:49:47 +0100 |
commit | 80b62dae14ce067fa9f13145d4ad8a8fef8b17a3 (patch) | |
tree | b1394ed93277777e602ada7bffe822bcf6e3e231 /source4/lib/util/util_strlist.c | |
parent | 5db23bce227b909b9577501f733e733023a2daa8 (diff) | |
download | samba-80b62dae14ce067fa9f13145d4ad8a8fef8b17a3.tar.gz samba-80b62dae14ce067fa9f13145d4ad8a8fef8b17a3.tar.bz2 samba-80b62dae14ce067fa9f13145d4ad8a8fef8b17a3.zip |
r26417: Make str_list_copy(mem_ctx, NULL) return NULL rather than an empty list.
(This used to be commit cf8636c8b77c745812376d0ea6f0fb6246a2e4fb)
Diffstat (limited to 'source4/lib/util/util_strlist.c')
-rw-r--r-- | source4/lib/util/util_strlist.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/lib/util/util_strlist.c b/source4/lib/util/util_strlist.c index 1f1cc17d00..30de4b962d 100644 --- a/source4/lib/util/util_strlist.c +++ b/source4/lib/util/util_strlist.c @@ -199,8 +199,14 @@ _PUBLIC_ size_t str_list_length(const char **list) _PUBLIC_ const char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list) { int i; - const char **ret = talloc_array(mem_ctx, const char *, str_list_length(list)+1); - if (ret == NULL) return NULL; + const char **ret; + + if (list == NULL) + return NULL; + + ret = talloc_array(mem_ctx, const char *, str_list_length(list)+1); + if (ret == NULL) + return NULL; for (i=0;list && list[i];i++) { ret[i] = talloc_strdup(ret, list[i]); |