diff mbox series

[v2,6/7] kernel-shark: Fix the checking if "trace_seq" was destroyed

Message ID 20210517142140.286153-7-y.karadz@gmail.com (mailing list archive)
State Accepted
Commit 0ecb2b501a5b62d5d318cd6094070e9a11ed555a
Headers show
Series Final fixes before KS 2.0 | expand

Commit Message

Yordan Karadzhov May 17, 2021, 2:21 p.m. UTC
When closing a "tep" data stream we destroy the "trace_seq" object.
However, trace_seq_destroy() sets the buffer to "TRACE_SEQ_POISON"
which is different from NULL.

Because TRACE_SEQ_POISON is an internal definition of libtraceevent,
we have to set the buffer to NULL in order to indicate that it was
destroyed.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/libkshark-tepdata.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c
index bc5babb..acc554b 100644
--- a/src/libkshark-tepdata.c
+++ b/src/libkshark-tepdata.c
@@ -1615,8 +1615,10 @@  int kshark_tep_close_interface(struct kshark_data_stream *stream)
 	if (!tep_handle)
 		return -EFAULT;
 
-	if (seq.buffer)
+	if (seq.buffer) {
 		trace_seq_destroy(&seq);
+		seq.buffer = NULL;
+	}
 
 	if (tep_handle->advanced_event_filter) {
 		tep_filter_reset(tep_handle->advanced_event_filter);