Skip to content

Commit

Permalink
Merge pull request #7978 from fluent/pwhelan-calyptia-fix-machine-id-…
Browse files Browse the repository at this point in the history
…leak

custom_calyptia: free machine_id when it is automatically set.
  • Loading branch information
pwhelan authored Oct 24, 2023
2 parents bf17059 + 76400c6 commit 747a620
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/custom_calyptia/calyptia.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct calyptia {
flb_sds_t cloud_host;
flb_sds_t cloud_port;
flb_sds_t machine_id;
int machine_id_auto_configured;

/* used for reporting chunk trace records. */
#ifdef FLB_HAVE_CHUNK_TRACE
Expand Down Expand Up @@ -426,6 +427,8 @@ static int cb_calyptia_init(struct flb_custom_instance *ins,
flb_plg_error(ctx->ins, "unable to retrieve machine_id");
return -1;
}

ctx->machine_id_auto_configured = 1;
}

/* input collector */
Expand Down Expand Up @@ -517,6 +520,10 @@ static int cb_calyptia_exit(void *data, struct flb_config *config)
return 0;
}

if (ctx->machine_id && ctx->machine_id_auto_configured) {
flb_sds_destroy(ctx->machine_id);
}

flb_free(ctx);
return 0;
}
Expand Down

0 comments on commit 747a620

Please sign in to comment.