From 0e3e56e4c8fd11b88977044068d90bdbcefde10a Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Fri, 3 Nov 2023 12:04:49 -0300 Subject: [PATCH] in_calyptia_fleet: free fleet_url and fleet_id. Signed-off-by: Phillip Whelan --- plugins/in_calyptia_fleet/in_calyptia_fleet.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/in_calyptia_fleet/in_calyptia_fleet.c b/plugins/in_calyptia_fleet/in_calyptia_fleet.c index bd6f80960c8..329b1d0c39f 100644 --- a/plugins/in_calyptia_fleet/in_calyptia_fleet.c +++ b/plugins/in_calyptia_fleet/in_calyptia_fleet.c @@ -67,7 +67,11 @@ struct flb_in_calyptia_fleet_config { long config_timestamp; flb_sds_t api_key; + flb_sds_t fleet_id; + /* flag used to mark fleet_id for release when found automatically. */ + int fleet_id_found; + flb_sds_t fleet_name; flb_sds_t machine_id; flb_sds_t config_dir; @@ -593,6 +597,7 @@ static ssize_t parse_fleet_search_json(struct flb_in_calyptia_fleet_config *ctx, return -1; } + ctx->fleet_id_found = 1; ctx->fleet_id = flb_sds_create_len(cur->val.via.str.ptr, cur->val.via.str.size); break; @@ -1209,6 +1214,14 @@ static int in_calyptia_fleet_exit(void *data, struct flb_config *config) (void) *config; struct flb_in_calyptia_fleet_config *ctx = (struct flb_in_calyptia_fleet_config *)data; + if (ctx->fleet_url) { + flb_sds_destroy(ctx->fleet_url); + } + + if (ctx->fleet_id && ctx->fleet_id_found) { + flb_sds_destroy(ctx->fleet_id); + } + flb_input_collector_delete(ctx->collect_fd, ctx->ins); flb_upstream_destroy(ctx->u); flb_free(ctx);