Skip to content

Commit 31abfbb

Browse files
nokute78edsiper
authored andcommitted
custom_calyptia: fix using after freed memory(#8530)
Signed-off-by: Takahiro Yamashita <[email protected]>
1 parent 47f4287 commit 31abfbb

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

plugins/custom_calyptia/calyptia.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ static struct flb_output_instance *setup_cloud_output(struct flb_config *config,
245245

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

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

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

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

270268
if (!label) {
271-
flb_free(ctx);
272269
return NULL;
273270
}
274271

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

318315
if (!label) {
319-
flb_free(ctx);
320316
return NULL;
321317
}
322318

@@ -455,6 +451,7 @@ static int cb_calyptia_init(struct flb_custom_instance *ins,
455451
ctx->o = setup_cloud_output(config, ctx);
456452

457453
if (ctx->o == NULL) {
454+
flb_free(ctx);
458455
return -1;
459456
}
460457
}

0 commit comments

Comments
 (0)