From 0ab187f0a6d803f507956fe28e669e37f89c364e Mon Sep 17 00:00:00 2001 From: Takahiro Yamashita Date: Mon, 31 May 2021 02:38:33 +0900 Subject: [PATCH] output: release instance when init failed (#3576) Signed-off-by: Takahiro Yamashita --- src/flb_output.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/flb_output.c b/src/flb_output.c index dc2ab3ce074..0e5b9b8470a 100644 --- a/src/flb_output.c +++ b/src/flb_output.c @@ -841,6 +841,7 @@ int flb_output_init_all(struct flb_config *config) if (p->type == FLB_OUTPUT_PLUGIN_PROXY) { ret = flb_plugin_proxy_init(p->proxy, ins, config); if (ret == -1) { + flb_output_instance_destroy(ins); return -1; } continue; @@ -878,6 +879,7 @@ int flb_output_init_all(struct flb_config *config) if (!config_map) { flb_error("[output] error loading config map for '%s' plugin", p->name); + flb_output_instance_destroy(ins); return -1; } ins->config_map = config_map; @@ -940,6 +942,7 @@ int flb_output_init_all(struct flb_config *config) if (ret == -1) { flb_error("[output] Failed to initialize '%s' plugin", p->name); + flb_output_instance_destroy(ins); return -1; } @@ -949,6 +952,7 @@ int flb_output_init_all(struct flb_config *config) if (ret == -1) { flb_error("[output] could not start thread pool for '%s' plugin", p->name); + flb_output_instance_destroy(ins); return -1; }