X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fview.c;h=0325e505c505fab3dab2bc666fa7caec40822aa4;hb=1da8d15ab5d1681b89567987fac70ca3b0703ba6;hp=faca60de8b980adfe60afcb2ac68a7c202a65595;hpb=68c7f6e55254fd6e54d7bb4a6c1316bb77843a6e;p=lttng-tools.git diff --git a/src/bin/lttng/commands/view.c b/src/bin/lttng/commands/view.c index faca60de8..0325e505c 100644 --- a/src/bin/lttng/commands/view.c +++ b/src/bin/lttng/commands/view.c @@ -302,6 +302,7 @@ static int view_trace(void) int ret; char *session_name, *trace_path = NULL; struct lttng_session *sessions = NULL; + bool free_trace_path = false; /* * Safety net. If lttng is suid at some point for *any* useless reasons, @@ -379,6 +380,7 @@ static int view_trace(void) ret = CMD_ERROR; goto free_sessions; } + free_trace_path = true; } else { /* Get file system session path. */ trace_path = sessions[i].path; @@ -396,7 +398,7 @@ static int view_trace(void) } free_sessions: - if (session_live_mode) { + if (session_live_mode && free_trace_path) { free(trace_path); } free(sessions);