Skip to content

Commit

Permalink
custom_calyptia: fix using after freed memory(#8530)
Browse files Browse the repository at this point in the history
Signed-off-by: Takahiro Yamashita <[email protected]>
  • Loading branch information
nokute78 committed Mar 1, 2024
1 parent 9d9ac68 commit ef23c7e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 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 @@ -455,6 +451,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

0 comments on commit ef23c7e

Please sign in to comment.