@@ -426,8 +426,9 @@ static int flb_proxy_register_input(struct flb_plugin_proxy *proxy,
426
426
int flb_proxy_custom_cb_init (struct flb_custom_instance * c_ins ,
427
427
struct flb_config * config , void * data );
428
428
429
- static int flb_proxy_custom_cb_exit (void * custom_context ,
429
+ static int flb_proxy_custom_cb_exit (void * custom_context ,
430
430
struct flb_config * config );
431
+ static void flb_proxy_custom_cb_destroy (struct flb_custom_plugin * plugin );
431
432
432
433
static int flb_proxy_register_custom (struct flb_plugin_proxy * proxy ,
433
434
struct flb_plugin_proxy_def * def ,
@@ -456,6 +457,7 @@ static int flb_proxy_register_custom(struct flb_plugin_proxy *proxy,
456
457
*/
457
458
custom -> cb_init = flb_proxy_custom_cb_init ;
458
459
custom -> cb_exit = flb_proxy_custom_cb_exit ;
460
+ custom -> cb_destroy = flb_proxy_custom_cb_destroy ;
459
461
return 0 ;
460
462
}
461
463
@@ -707,3 +709,22 @@ int flb_proxy_custom_cb_exit(void *custom_context,
707
709
flb_free (ctx );
708
710
return ret ;
709
711
}
712
+
713
+ static void flb_proxy_custom_cb_destroy (struct flb_custom_plugin * plugin )
714
+ {
715
+ struct flb_plugin_proxy * proxy = (struct flb_plugin_proxy * ) plugin -> proxy ;
716
+
717
+ if (plugin -> name != NULL ) {
718
+ flb_free (plugin -> name );
719
+
720
+ plugin -> name = NULL ;
721
+ }
722
+
723
+ if (proxy -> def -> proxy == FLB_PROXY_GOLANG ) {
724
+ #ifdef FLB_HAVE_PROXY_GO
725
+ proxy_go_custom_unregister (proxy -> data );
726
+ #endif
727
+ }
728
+
729
+ flb_plugin_proxy_destroy (proxy );
730
+ }
0 commit comments