Broken by commit
081311398b0deca05eebaac8672efbc9af272d36
Fix by only creating the handle if kernel or ust is specified (so it
still fixes the valgrind warning).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
} else if (opt_userspace) {
DBG2("Listing userspace global domain");
domain.type = LTTNG_DOMAIN_UST;
} else if (opt_userspace) {
DBG2("Listing userspace global domain");
domain.type = LTTNG_DOMAIN_UST;
- } else {
- usage(stderr);
- ret = CMD_UNDEFINED;
- goto end;
- 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 (session_name == NULL) {
}
/* Clean handle before creating a new one */
}
/* 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) {
handle = lttng_create_handle(session_name, &domains[i]);
if (handle == NULL) {
if (domains) {
free(domains);
}
if (domains) {
free(domains);
}
- lttng_destroy_handle(handle);
+ if (handle) {
+ lttng_destroy_handle(handle);
+ }
poptFreeContext(pc);
return ret;
poptFreeContext(pc);
return ret;