diff --git a/src/curl_json.c b/src/curl_json.c
index 448db15eed78d91f34028b39d6577ea3048b914e..a547ddcd42a53ac9198475cb78387aed95f87c7b 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
{
const data_set_t *ds;
+ if ((key == NULL) || !CJ_IS_KEY (key))
+ return -EINVAL;
+
ds = plugin_get_ds (key->type);
if (ds == NULL)
{
buffer[sizeof (buffer) - 1] = 0;
if ((key == NULL) || !CJ_IS_KEY (key)) {
- if (key != NULL && !db->state[db->depth].in_array/*can be inhomogeneous*/)
+ if (key != NULL && !db->state[db->depth].in_array/*can be inhomogeneous*/) {
NOTICE ("curl_json plugin: Found \"%s\", but the configuration expects"
" a map.", buffer);
+ return (CJ_CB_CONTINUE);
+ }
+
cj_cb_inc_array_index (ctx, /* update_key = */ 1);
key = db->state[db->depth].key;
- if (key == NULL) {
+ if ((key == NULL) || !CJ_IS_KEY (key)) {
return (CJ_CB_CONTINUE);
}
}
static int cj_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
oconfig_item_t *ci)
{
+ struct curl_slist *temp = NULL;
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("curl_json plugin: `%s' needs exactly one string argument.", name);
return (-1);
}
- *dest = curl_slist_append(*dest, ci->values[0].value.string);
- if (*dest == NULL)
+ temp = curl_slist_append(*dest, ci->values[0].value.string);
+ if (temp == NULL)
return (-1);
+ *dest = temp;
+
return (0);
} /* }}} int cj_config_append_string */