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: free machine_id when it is automatically set. #7978

Merged
merged 1 commit into from
Oct 24, 2023
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: 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
Loading