Skip to content

Commit

Permalink
in_calyptia_fleet: free http client when retrieving fleet_id from fle…
Browse files Browse the repository at this point in the history
…et_name.

Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan committed Nov 3, 2023
1 parent 0e3e56e commit 1563733
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/in_calyptia_fleet/in_calyptia_fleet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 1563733

Please sign in to comment.