Commit 4f753c3b authored by Andreas Schwab's avatar Andreas Schwab Committed by Steven Rostedt (Google)

rtla: Fix double free

Avoid double free by making trace_instance_destroy indempotent.  When
trace_instance_init fails, it calls trace_instance_destroy, but its only
caller osnoise_destroy_tool calls it again.

Link: https://lkml.kernel.org/r/mvmilnlkyzx.fsf_-_@suse.de

Fixes: 0605bf00 ("rtla: Add osnoise tool")
Signed-off-by: default avatarAndreas Schwab <schwab@suse.de>
Acked-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent c7d8a598
......@@ -134,13 +134,18 @@ void trace_instance_destroy(struct trace_instance *trace)
if (trace->inst) {
disable_tracer(trace->inst);
destroy_instance(trace->inst);
trace->inst = NULL;
}
if (trace->seq)
if (trace->seq) {
free(trace->seq);
trace->seq = NULL;
}
if (trace->tep)
if (trace->tep) {
tep_free(trace->tep);
trace->tep = NULL;
}
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment