summaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
authornicm <nicm>2019-05-12 18:16:33 +0000
committernicm <nicm>2019-05-12 18:16:33 +0000
commit00f19b7f9160f32b3736da08116e5ea4f2409bb1 (patch)
treef025c269067ac4f75725c5ac7bcf2a418a653540 /options.c
parenta13165523598fa7670ebc95f3cfb5c892d08745a (diff)
Fix some indentation and dead assignments.
Diffstat (limited to 'options.c')
-rw-r--r--options.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/options.c b/options.c
index c5a776e5..488f6cf9 100644
--- a/options.c
+++ b/options.c
@@ -354,16 +354,23 @@ options_array_set(struct options_entry *o, u_int idx, const char *value,
struct options_array_item *a;
char *new;
struct cmd_list *cmdlist;
+ char *error;
if (!OPTIONS_IS_ARRAY(o)) {
- *cause = xstrdup("not an array");
+ if (cause != NULL)
+ *cause = xstrdup("not an array");
return (-1);
}
if (OPTIONS_IS_COMMAND(o)) {
- cmdlist = cmd_string_parse(value, NULL, 0, cause);
- if (cmdlist == NULL && *cause != NULL)
+ cmdlist = cmd_string_parse(value, NULL, 0, &error);
+ if (cmdlist == NULL && error != NULL) {
+ if (cause != NULL)
+ *cause = error;
+ else
+ free(error);
return (-1);
+ }
}
a = options_array_item(o, idx);