Skip to content

Commit

Permalink
input_metric: fixed a double free
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Alminana <[email protected]>
  • Loading branch information
leonardo-albertovich authored and edsiper committed Apr 9, 2024
1 parent 1b7a453 commit 6ce0afd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/flb_input_metric.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,16 @@ static int input_metrics_append(struct flb_input_instance *ins,
if (out_context != NULL) {
/* Convert metrics to msgpack */
ret = cmt_encode_msgpack_create(out_context, &mt_buf, &mt_size);

if (out_context != cmt) {
cmt_destroy(out_context);
}

if (ret != 0) {
flb_plg_error(ins, "could not encode metrics");
cmt_destroy(out_context);

return -1;
}

cmt_destroy(out_context);
}
else {
/* Convert metrics to msgpack */
Expand Down

0 comments on commit 6ce0afd

Please sign in to comment.