X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Flist.c;h=65d8ea6f5c45424444262f87dd4ff7c7e38bbb70;hp=28166c8be28e5a9588d14d8f14adfd56a39810dd;hb=aff0fa7248c73edb8e02578c83e338716cf695ec;hpb=20dd2de1fa1efe1519d1b6e88386efa89d60d1b9 diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 28166c8be..65d8ea6f5 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -1825,7 +1825,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); @@ -1838,7 +1838,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 */ @@ -1846,7 +1846,7 @@ static int list_sessions(const char *session_name) } if (ret) { ret = CMD_ERROR; - goto error; + goto end; } } else { /* Pretty print */ @@ -1893,7 +1893,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) { @@ -1901,9 +1901,8 @@ static int list_sessions(const char *session_name) } } -error: - free(sessions); end: + free(sessions); return ret; }