Skip to content

Commit 5cade1b

Browse files
committed
encode_opentelemetry: Plug memory leaks on cutoff
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 38b1ee4 commit 5cade1b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cmt_encode_opentelemetry.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,6 +2449,8 @@ int pack_basic_type(struct cmt_opentelemetry_context *context,
24492449

24502450
if (check_staled_timestamp(&map->metric, now,
24512451
CMT_ENCODE_OPENTELEMETRY_CUTOFF_THRESHOLD)) {
2452+
destroy_metric(metric);
2453+
24522454
/* Skip processing metrics which are staled over the threshold */
24532455
return CMT_ENCODE_OPENTELEMETRY_CUTOFF_ERROR;
24542456
}
@@ -2465,6 +2467,8 @@ int pack_basic_type(struct cmt_opentelemetry_context *context,
24652467

24662468
if (check_staled_timestamp(&map->metric, now,
24672469
CMT_ENCODE_OPENTELEMETRY_CUTOFF_THRESHOLD)) {
2470+
destroy_metric(metric);
2471+
24682472
/* Skip processing metrics which are staled over the threshold */
24692473
return CMT_ENCODE_OPENTELEMETRY_CUTOFF_ERROR;
24702474
}

0 commit comments

Comments
 (0)