Skip to content

Commit 3493b52

Browse files
committed
fix(plugin): correctly free trace record on interruption
Trace records need to be freed with tracecdm_free_record instead of free. This was done incorrectly when finalizing the message iterator. However, the bug remained unnoticed as the record is NULL on full iteration, hence the free() is simply a noop. On partial iteration, the record was not properly freed, leading to a leak and debug output. Signed-off-by: Felix Moessbauer <[email protected]>
1 parent c1e921f commit 3493b52

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/bt-ftrace-source.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,7 @@ void ftrace_in_message_iterator_finalize(
585585
struct ftrace_in_message_iterator *ftrace_in_iter =
586586
bt_self_message_iterator_get_data(self_message_iterator);
587587

588-
/* Close the input file */
589-
free(ftrace_in_iter->rec);
588+
tracecmd_free_record(ftrace_in_iter->rec);
590589

591590
/* Redundant, as the packet is always closed when finishing the stream */
592591
BT_PACKET_PUT_REF_AND_RESET(ftrace_in_iter->packet);

0 commit comments

Comments
 (0)