switch (event->type) {
case LTTNG_EVENT_TRACEPOINT:
{
- MSG("%s%s%s%s%d%s (type: tracepoint)%s", indent6,
+ MSG("%s%s%s%s%s (type: tracepoint)%s", indent6,
event->name,
loglevel_string_pre(event->loglevel),
loglevel_string(event->loglevel),
- event->loglevel,
loglevel_string_post(event->loglevel),
enabled_string(event->enabled));
break;
struct lttng_event *event_list;
pid_t cur_pid = 0;
+ memset(&domain, 0, sizeof(domain));
+
DBG("Getting UST tracing events");
domain.type = LTTNG_DOMAIN_UST;
size = lttng_list_tracepoints(handle, &event_list);
if (size < 0) {
ERR("Unable to list UST events");
+ lttng_destroy_handle(handle);
return size;
}
MSG("");
free(event_list);
+ lttng_destroy_handle(handle);
return CMD_SUCCESS;
error:
+ lttng_destroy_handle(handle);
return -1;
}
struct lttng_handle *handle;
struct lttng_event *event_list;
+ memset(&domain, 0, sizeof(domain));
+
DBG("Getting kernel tracing events");
domain.type = LTTNG_DOMAIN_KERNEL;
size = lttng_list_tracepoints(handle, &event_list);
if (size < 0) {
ERR("Unable to list kernel events");
+ lttng_destroy_handle(handle);
return size;
}
free(event_list);
+ lttng_destroy_handle(handle);
return CMD_SUCCESS;
error:
+ lttng_destroy_handle(handle);
return -1;
}
continue;
}
- MSG(" %d) %s (%s)%s", i + 1, sessions[i].name, sessions[i].path, active_string(sessions[i].enabled));
+ MSG(" %d) %s (%s)%s", i + 1, sessions[i].name, sessions[i].path,
+ active_string(sessions[i].enabled));
if (session_found) {
break;
free(sessions);
if (!session_found && session_name != NULL) {
- ERR("Session %s not found", session_name);
+ ERR("Session '%s' not found", session_name);
+ ret = CMD_ERROR;
+ goto error;
}
if (session_name == NULL) {
struct lttng_domain domain;
struct lttng_domain *domains = NULL;
+ memset(&domain, 0, sizeof(domain));
+
if (argc < 1) {
usage(stderr);
ret = CMD_ERROR;
domain.type = LTTNG_DOMAIN_UST;
}
- handle = lttng_create_handle(session_name, &domain);
- if (handle == NULL) {
- ret = CMD_FATAL;
- goto end;
+ if (opt_kernel || opt_userspace) {
+ handle = lttng_create_handle(session_name, &domain);
+ if (handle == NULL) {
+ ret = CMD_FATAL;
+ goto end;
+ }
}
if (session_name == NULL) {
if (!opt_kernel && !opt_userspace) {
ret = list_sessions(NULL);
- if (ret < 0) {
+ if (ret != 0) {
goto end;
}
}
} else {
/* List session attributes */
ret = list_sessions(session_name);
- if (ret < 0) {
+ if (ret != 0) {
goto end;
}
}
/* Clean handle before creating a new one */
- lttng_destroy_handle(handle);
+ if (handle) {
+ lttng_destroy_handle(handle);
+ }
handle = lttng_create_handle(session_name, &domains[i]);
if (handle == NULL) {
if (domains) {
free(domains);
}
- lttng_destroy_handle(handle);
+ if (handle) {
+ lttng_destroy_handle(handle);
+ }
poptFreeContext(pc);
return ret;