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

out_stackdriver: fixed a memory leak (CID 508244) #9299

Merged
merged 2 commits into from
Aug 29, 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
35 changes: 33 additions & 2 deletions plugins/out_stackdriver/stackdriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2304,9 +2304,22 @@ static flb_sds_t stackdriver_format(struct flb_stackdriver *ctx,
insert_id_extracted = FLB_FALSE;
}
else {
if (trace_extracted == FLB_TRUE) {
flb_sds_destroy(trace);
}

if (span_id_extracted == FLB_TRUE) {
flb_sds_destroy(span_id);
}

if (project_id_extracted == FLB_TRUE) {
flb_sds_destroy(project_id_key);
}

if (log_name_extracted == FLB_TRUE) {
flb_sds_destroy(log_name);
}

continue;
}

Expand Down Expand Up @@ -2357,10 +2370,28 @@ static flb_sds_t stackdriver_format(struct flb_stackdriver *ctx,
flb_plg_error(ctx->ins, "the type of payload labels should be map");
flb_sds_destroy(operation_id);
flb_sds_destroy(operation_producer);
flb_sds_destroy(trace);
flb_sds_destroy(log_name);
flb_sds_destroy(source_location_file);
flb_sds_destroy(source_location_function);

if (trace_extracted == FLB_TRUE) {
flb_sds_destroy(trace);
}

if (span_id_extracted == FLB_TRUE) {
flb_sds_destroy(span_id);
}

if (project_id_extracted == FLB_TRUE) {
flb_sds_destroy(project_id_key);
}

if (log_name_extracted == FLB_TRUE) {
flb_sds_destroy(log_name);
}

flb_log_event_decoder_destroy(&log_decoder);
msgpack_sbuffer_destroy(&mp_sbuf);

return NULL;
}

Expand Down
Loading