Re: [PATCH 3/8] rtla/osnoise_top: Fix segmentation fault when failing to enable -t

From: Steven Rostedt
Date: Thu Feb 03 2022 - 11:43:12 EST


On Thu, 3 Feb 2022 11:41:26 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> Wouldn't these four patches be more robust if you just initialized record
> (and tool) to NULL, and change osnoise_destroy_tool() to:

And if you do this, it should be one patch, not four.

-- Steve

>
> void osnoise_destroy_tool(struct osnoise_tool *top)
> {
> if (!top)
> return;
>
> trace_instance_destroy(&top->trace);
>
> if (top->context)
> osnoise_put_context(top->context);
>
> free(top);
> }
>
> Then you don't need these extra labels and if statements in the main code.