summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-04-15 13:49:59 +0200
committerMichael Adam <obnox@samba.org>2008-04-15 17:40:27 +0200
commitb396ad07d131fba4945060b35c870abec626cbc8 (patch)
tree2db0c631ec2b04cd2988b78e79b74331da8f60d0 /source3/lib
parentc05c5dba8a3ae832df4d2b1c58761089147288f1 (diff)
downloadsamba-b396ad07d131fba4945060b35c870abec626cbc8.tar.gz
samba-b396ad07d131fba4945060b35c870abec626cbc8.tar.bz2
samba-b396ad07d131fba4945060b35c870abec626cbc8.zip
libsmbconf: add handling of "NULL" strings to smbconf_add_string_to_array()
Michael (This used to be commit aba261a9143bc7ab681b1c57ccfc08da0cffcfe7)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/smbconf/smbconf_util.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source3/lib/smbconf/smbconf_util.c b/source3/lib/smbconf/smbconf_util.c
index 1a3a0ded44..20bd51a62b 100644
--- a/source3/lib/smbconf/smbconf_util.c
+++ b/source3/lib/smbconf/smbconf_util.c
@@ -82,7 +82,7 @@ WERROR smbconf_add_string_to_array(TALLOC_CTX *mem_ctx,
{
char **new_array = NULL;
- if ((array == NULL) || (string == NULL)) {
+ if (array == NULL) {
return WERR_INVALID_PARAM;
}
@@ -91,10 +91,14 @@ WERROR smbconf_add_string_to_array(TALLOC_CTX *mem_ctx,
return WERR_NOMEM;
}
- new_array[count] = talloc_strdup(new_array, string);
- if (new_array[count] == NULL) {
- TALLOC_FREE(new_array);
- return WERR_NOMEM;
+ if (string == NULL) {
+ new_array[count] = NULL;
+ } else {
+ new_array[count] = talloc_strdup(new_array, string);
+ if (new_array[count] == NULL) {
+ TALLOC_FREE(new_array);
+ return WERR_NOMEM;
+ }
}
*array = new_array;