summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;