From 80715793a0776d0bdcb8f04de68961086f8cd006 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 17 May 2016 15:09:03 -0400 Subject: [PATCH] Fix: Don't dereference null ptr in error path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes coverity #1355339 Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- formats/ctf/ctf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index c5d654c9..bc962121 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -2431,8 +2431,10 @@ struct bt_trace_descriptor *ctf_open_trace(const char *path, int flags, return &td->parent; error: - trace_debug_info_destroy(td); - g_free(td); + if (td) { + trace_debug_info_destroy(td); + g_free(td); + } return NULL; } -- 2.34.1