X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Flist.c;h=0a770187ae6e89b369b5f213daeddbbc2b24bd91;hb=0b2374eb38d39fa112bfac06f5140b06b33e221b;hp=898c0de6a02e1a2735d9ce5f59067fe10fe788fb;hpb=c57c2c7421d2bd7611d316ac8ca1cb443e1bc95c;p=lttng-tools.git diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 898c0de6a..0a770187a 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -1601,7 +1601,7 @@ static int list_sessions(const char *session_name) int ret = CMD_SUCCESS; int count, i; unsigned int session_found = 0; - struct lttng_session *sessions; + struct lttng_session *sessions = NULL; count = lttng_list_sessions(&sessions); DBG("Session count %d", count); @@ -1614,7 +1614,7 @@ static int list_sessions(const char *session_name) if (lttng_opt_mi) { /* Mi */ if (session_name == NULL) { - /* List all session */ + /* List all sessions */ ret = mi_list_sessions(sessions, count); } else { /* Note : this return an open session element */ @@ -1622,7 +1622,7 @@ static int list_sessions(const char *session_name) } if (ret) { ret = CMD_ERROR; - goto error; + goto end; } } else { /* Pretty print */ @@ -1665,7 +1665,7 @@ static int list_sessions(const char *session_name) if (!session_found && session_name != NULL) { ERR("Session '%s' not found", session_name); ret = CMD_ERROR; - goto error; + goto end; } if (session_name == NULL) { @@ -1673,9 +1673,8 @@ static int list_sessions(const char *session_name) } } -error: - free(sessions); end: + free(sessions); return ret; }