X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fcurl_json.c;h=5aceae4e59e45ee55e3400340660c51b4dc4f78f;hb=20d15cfd26b23508242abcead906207bf26175d0;hp=1c225f79cec84de3e155e825e9367f6f5e405ab4;hpb=0003c4d3c184f0f437499d6073cd023dc7b659c2;p=collectd.git diff --git a/src/curl_json.c b/src/curl_json.c index 1c225f79..5aceae4e 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -503,6 +503,7 @@ static int cj_config_add_key (cj_t *db, /* {{{ */ { ERROR ("curl_json plugin: cj_config: " "Invalid key: %s", ci->key); + cj_key_free (key); return (-1); } @@ -562,7 +563,7 @@ static int cj_config_add_key (cj_t *db, /* {{{ */ if (*ptr == '/') { c_avl_tree_t *value; - int len; + size_t len; len = ptr-name; if (len == 0) @@ -696,6 +697,7 @@ static int cj_config_add_url (oconfig_item_t *ci) /* {{{ */ { ERROR ("curl_json plugin: cj_config: " "Invalid key: %s", ci->key); + cj_free (db); return (-1); } if (status != 0) @@ -762,9 +764,6 @@ static int cj_config_add_url (oconfig_item_t *ci) /* {{{ */ { user_data_t ud; char *cb_name; - struct timespec interval = { 0, 0 }; - - CDTIME_T_TO_TIMESPEC (db->interval, &interval); if (db->instance == NULL) db->instance = strdup("default"); @@ -780,7 +779,7 @@ static int cj_config_add_url (oconfig_item_t *ci) /* {{{ */ db->instance, db->url ? db->url : db->sock); plugin_register_complex_read (/* group = */ NULL, cb_name, cj_read, - /* interval = */ (db->interval > 0) ? &interval : NULL, + /* interval = */ db->interval, &ud); sfree (cb_name); }