Skip to content

Commit

Permalink
encode_opentelemetry: Plug memory leaks on cutoff
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
  • Loading branch information
cosmo0920 committed Sep 25, 2024
1 parent 38b1ee4 commit 5cade1b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cmt_encode_opentelemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -2449,6 +2449,8 @@ int pack_basic_type(struct cmt_opentelemetry_context *context,

if (check_staled_timestamp(&map->metric, now,
CMT_ENCODE_OPENTELEMETRY_CUTOFF_THRESHOLD)) {
destroy_metric(metric);

/* Skip processing metrics which are staled over the threshold */
return CMT_ENCODE_OPENTELEMETRY_CUTOFF_ERROR;
}
Expand All @@ -2465,6 +2467,8 @@ int pack_basic_type(struct cmt_opentelemetry_context *context,

if (check_staled_timestamp(&map->metric, now,
CMT_ENCODE_OPENTELEMETRY_CUTOFF_THRESHOLD)) {
destroy_metric(metric);

/* Skip processing metrics which are staled over the threshold */
return CMT_ENCODE_OPENTELEMETRY_CUTOFF_ERROR;
}
Expand Down

0 comments on commit 5cade1b

Please sign in to comment.