X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Ftail.c;h=181b752fd11328549c9e43f5c2de7e230b9737a2;hb=73664a19a54b440056f0f346e444b1d06626f481;hp=5b9dc53988c46440c839878253385dd097f8d3ad;hpb=4c841b9284f77e3e5f123c162f2f50e03d3b9f0c;p=collectd.git diff --git a/src/tail.c b/src/tail.c index 5b9dc539..181b752f 100644 --- a/src/tail.c +++ b/src/tail.c @@ -223,20 +223,20 @@ 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 ("Match", option->key) == 0) { status = ctail_config_add_match (tm, plugin_instance, option); if (status == 0) - num_matches++; + num_matches++; /* Be mild with failed matches.. */ status = 0; } @@ -252,10 +252,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); } @@ -264,7 +266,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.");