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);
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 */
}
if (ret) {
ret = CMD_ERROR;
- goto error;
+ goto end;
}
} else {
/* Pretty print */
if (!session_found && session_name != NULL) {
ERR("Session '%s' not found", session_name);
ret = CMD_ERROR;
- goto error;
+ goto end;
}
if (session_name == NULL) {
}
}
-error:
- free(sessions);
end:
+ free(sessions);
return ret;
}