From 79e61bd8fd4cc0c6ef31ca1443dd804bae135276 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Tue, 12 Dec 2023 13:35:13 +0900 Subject: [PATCH] go: plugin_proxy: Handle FLBPluginInit(cb_init) error correctly and plug a SEGV case Signed-off-by: Hiroshi Hatake --- src/flb_plugin_proxy.c | 6 ++++++ src/proxy/go/go.c | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/flb_plugin_proxy.c b/src/flb_plugin_proxy.c index 5acba5e7078..48bf17525b4 100644 --- a/src/flb_plugin_proxy.c +++ b/src/flb_plugin_proxy.c @@ -525,6 +525,12 @@ int flb_proxy_output_cb_init(struct flb_output_instance *o_ins, pc->proxy->def->proxy); } + if (ret == -1) { + flb_error("[output] could not initialize '%s' plugin", + o_ins->p->name); + return -1; + } + /* Multi-threading enabled if configured */ ret = flb_output_enable_multi_threading(o_ins, config); if (ret == -1) { diff --git a/src/proxy/go/go.c b/src/proxy/go/go.c index 9d95a88afcc..e77af80a0d8 100644 --- a/src/proxy/go/go.c +++ b/src/proxy/go/go.c @@ -110,7 +110,6 @@ int proxy_go_output_init(struct flb_plugin_proxy *proxy) if (ret <= 0) { flb_error("[go proxy]: plugin '%s' failed to initialize", plugin->name); - flb_free(plugin); return -1; }