Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom_calyptia: fix using after freed memory(#8530) #8543

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions plugins/custom_calyptia/calyptia.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ static struct flb_output_instance *setup_cloud_output(struct flb_config *config,

if (!cloud) {
flb_plg_error(ctx->ins, "could not load Calyptia Cloud connector");
flb_free(ctx);
return NULL;
}

Expand All @@ -254,7 +253,6 @@ static struct flb_output_instance *setup_cloud_output(struct flb_config *config,

if (ret != 0) {
flb_plg_error(ctx->ins, "could not load Calyptia Cloud connector");
flb_free(ctx);
return NULL;
}

Expand All @@ -268,7 +266,6 @@ static struct flb_output_instance *setup_cloud_output(struct flb_config *config,
label = flb_sds_create_size(strlen(key->str) + strlen(val->str) + 1);

if (!label) {
flb_free(ctx);
return NULL;
}

Expand Down Expand Up @@ -316,7 +313,6 @@ static struct flb_output_instance *setup_cloud_output(struct flb_config *config,
label = flb_sds_create_size(strlen("fleet_id") + strlen(ctx->fleet_id) + 1);

if (!label) {
flb_free(ctx);
return NULL;
}

Expand Down Expand Up @@ -424,6 +420,7 @@ static int cb_calyptia_init(struct flb_custom_instance *ins,

if (ctx->machine_id == NULL) {
flb_plg_error(ctx->ins, "unable to retrieve machine_id");
flb_free(ctx);
return -1;
}

Expand All @@ -435,6 +432,7 @@ static int cb_calyptia_init(struct flb_custom_instance *ins,

if (!ctx->i) {
flb_plg_error(ctx->ins, "could not load metrics collector");
flb_free(ctx);
return -1;
}

Expand All @@ -455,6 +453,7 @@ static int cb_calyptia_init(struct flb_custom_instance *ins,
ctx->o = setup_cloud_output(config, ctx);

if (ctx->o == NULL) {
flb_free(ctx);
return -1;
}
}
Expand Down
Loading