From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> The error path only happens after the instance has been allocated. No need to check if it exists again. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=217127 Reported-by: Markus Elfring <Markus.Elfring@xxxxxx> Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> --- tracecmd/trace-record.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index b094f0699a43..41d765b593b7 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -387,11 +387,9 @@ struct buffer_instance *allocate_instance(const char *name) return instance; error: - if (instance) { - free(instance->name); - tracefs_instance_free(instance->tracefs); - free(instance); - } + free(instance->name); + tracefs_instance_free(instance->tracefs); + free(instance); return NULL; } -- 2.39.2