From c5aebcee4e6c67707576416c52549784ee60b6e2 Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Fri, 3 Nov 2023 12:05:35 -0300 Subject: [PATCH] in_calyptia_fleet: free http client when retrieving fleet_id from fleet_name. Signed-off-by: Phillip Whelan --- plugins/in_calyptia_fleet/in_calyptia_fleet.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/in_calyptia_fleet/in_calyptia_fleet.c b/plugins/in_calyptia_fleet/in_calyptia_fleet.c index ca498b48a3e..d81628e5772 100644 --- a/plugins/in_calyptia_fleet/in_calyptia_fleet.c +++ b/plugins/in_calyptia_fleet/in_calyptia_fleet.c @@ -686,27 +686,34 @@ static int get_calyptia_fleet_id_by_name(struct flb_in_calyptia_fleet_config *ct if (ret != 0) { flb_plg_error(ctx->ins, "http do error"); + flb_http_client_destroy(client); return -1; } if (client->resp.status != 200) { flb_plg_error(ctx->ins, "search http status code error: %d", client->resp.status); + flb_http_client_destroy(client); return -1; } if (client->resp.payload_size <= 0) { flb_plg_error(ctx->ins, "empty response"); + flb_http_client_destroy(client); return -1; } if (parse_fleet_search_json(ctx, client->resp.payload, client->resp.payload_size) == -1) { flb_plg_error(ctx->ins, "unable to find fleet: %s", ctx->fleet_name); + flb_http_client_destroy(client); return -1; } if (ctx->fleet_id == NULL) { + flb_http_client_destroy(client); return -1; } + + flb_http_client_destroy(client); return 0; }