Skip to content

Commit

Permalink
plugin_proxy: invoke flb_plugin_proxy_destroy on exit
Browse files Browse the repository at this point in the history
Signed-off-by: Takahiro Yamashita <[email protected]>
  • Loading branch information
nokute78 committed Jul 29, 2021
1 parent 2ca0de5 commit 6d27f38
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/flb_plugin_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void flb_proxy_cb_flush(const void *data, size_t bytes,
FLB_OUTPUT_RETURN(ret);
}


static void flb_plugin_proxy_destroy(struct flb_plugin_proxy *proxy);
static int flb_proxy_cb_exit(void *data, struct flb_config *config)
{
struct flb_output_plugin *instance = data;
Expand All @@ -74,6 +74,7 @@ static int flb_proxy_cb_exit(void *data, struct flb_config *config)
if (proxy->def->proxy == FLB_PROXY_GOLANG) {
proxy_go_destroy(proxy->data);
}
flb_plugin_proxy_destroy(proxy);
return 0;
}

Expand Down Expand Up @@ -243,9 +244,15 @@ struct flb_plugin_proxy *flb_plugin_proxy_create(const char *dso_path, int type,
return proxy;
}

void flb_plugin_proxy_destroy(struct flb_plugin_proxy *proxy)
static void flb_plugin_proxy_destroy(struct flb_plugin_proxy *proxy)
{
/* cleanup */
void (*cb_unregister)(struct flb_plugin_proxy_def *def);

cb_unregister = flb_plugin_proxy_symbol(proxy, "FLBPluginUnregister");
if (cb_unregister != NULL) {
cb_unregister(proxy->def);
}
flb_free(proxy->def);
flb_api_destroy(proxy->api);
dlclose(proxy->dso_handler);
Expand Down

0 comments on commit 6d27f38

Please sign in to comment.