Skip to content

Commit

Permalink
encode_opentelemetry: release on exception (CID 507869 507898)
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Aug 13, 2024
1 parent 242ea81 commit adfb348
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ctr_encode_opentelemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ static Opentelemetry__Proto__Trace__V1__ResourceSpans **set_resource_spans(struc

otel_resource_span = initialize_resource_span();
if (!otel_resource_span) {
free(rs);
return NULL;
}
otel_resource_span->resource = ctr_set_resource(resource_span->resource);
Expand Down Expand Up @@ -1305,12 +1306,12 @@ cfl_sds_t ctr_encode_opentelemetry_create(struct ctrace *ctr)
len = opentelemetry__proto__collector__trace__v1__export_trace_service_request__get_packed_size(req);
buf = cfl_sds_create_size(len);
if (!buf) {
destroy_export_service_request(req);
return NULL;
}
cfl_sds_set_len(buf, len);

opentelemetry__proto__collector__trace__v1__export_trace_service_request__pack(req, (uint8_t *)buf);

destroy_export_service_request(req);

return buf;
Expand Down

0 comments on commit adfb348

Please sign in to comment.