Free the filter chain struct on errors and do not try to
close filters that haven't been opened.
fn = fc->filter_nodes + i;
ret = check_filter_arg(fa, &fn->conf);
if (ret < 0)
- return ret;
+ goto err;
fn->filter_num = ret;
fn->fc = fc;
INIT_LIST_HEAD(&fn->callbacks);
}
open_filters();
return 1;
+err:
+ free(fc->filter_nodes);
+ return ret;
}
static int parse_config(int argc, char *argv[])
s.default_timeout.tv_sec = 1;
s.default_timeout.tv_usec = 0;
ret = schedule(&s);
+ close_filters(fc);
out:
free(sit->buf);
- close_filters(fc);
if (ret < 0)
PARA_EMERG_LOG("%s\n", para_strerror(-ret));
return ret < 0? EXIT_FAILURE : EXIT_SUCCESS;