X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Ftail.c;h=708cd2a32737e0a10678bc7d650c48c4c6029ba8;hb=c21ce3b44f63d706b8b200a88047db74f1a51392;hp=e5f24d11280ef0eaa250016f2fa66a56e559d30f;hpb=09c6a320f3cb36b5dbb2c2ce43858f33be7acf9b;p=collectd.git diff --git a/src/tail.c b/src/tail.c index e5f24d11..708cd2a3 100644 --- a/src/tail.c +++ b/src/tail.c @@ -236,14 +236,14 @@ static int ctail_config_add_file (oconfig_item_t *ci) if (tm == NULL) { ERROR ("tail plugin: tail_match_create (%s) failed.", - ci->values[0].value.string); + ci->values[0].value.string); return (-1); } for (i = 0; i < ci->children_num; i++) { oconfig_item_t *option = ci->children + i; - int status; + int status = 0; if (strcasecmp ("Instance", option->key) == 0) status = cf_util_get_string (option, &plugin_instance); @@ -253,7 +253,7 @@ static int ctail_config_add_file (oconfig_item_t *ci) { status = ctail_config_add_match (tm, plugin_instance, option, interval); if (status == 0) - num_matches++; + num_matches++; /* Be mild with failed matches.. */ status = 0; } @@ -266,10 +266,12 @@ static int ctail_config_add_file (oconfig_item_t *ci) break; } /* for (i = 0; i < ci->children_num; i++) */ + sfree (plugin_instance); + if (num_matches == 0) { ERROR ("tail plugin: No (valid) matches found for file `%s'.", - ci->values[0].value.string); + ci->values[0].value.string); tail_match_destroy (tm); return (-1); } @@ -278,7 +280,7 @@ static int ctail_config_add_file (oconfig_item_t *ci) cu_tail_match_t **temp; temp = (cu_tail_match_t **) realloc (tail_match_list, - sizeof (cu_tail_match_t *) * (tail_match_list_num + 1)); + sizeof (cu_tail_match_t *) * (tail_match_list_num + 1)); if (temp == NULL) { ERROR ("tail plugin: realloc failed.");