projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix list command
[lttng-tools.git]
/
src
/
bin
/
lttng
/
commands
/
list.c
diff --git
a/src/bin/lttng/commands/list.c
b/src/bin/lttng/commands/list.c
index e4ab97cbe920c67c385e30fceccb8a68a271a145..4a53968740bd789aa8216bfda39029396c346b72 100644
(file)
--- a/
src/bin/lttng/commands/list.c
+++ b/
src/bin/lttng/commands/list.c
@@
-246,6
+246,8
@@
static int list_ust_events(void)
struct lttng_event *event_list;
pid_t cur_pid = 0;
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;
DBG("Getting UST tracing events");
domain.type = LTTNG_DOMAIN_UST;
@@
-258,6
+260,7
@@
static int list_ust_events(void)
size = lttng_list_tracepoints(handle, &event_list);
if (size < 0) {
ERR("Unable to list UST events");
size = lttng_list_tracepoints(handle, &event_list);
if (size < 0) {
ERR("Unable to list UST events");
+ lttng_destroy_handle(handle);
return size;
}
return size;
}
@@
-278,10
+281,12
@@
static int list_ust_events(void)
MSG("");
free(event_list);
MSG("");
free(event_list);
+ lttng_destroy_handle(handle);
return CMD_SUCCESS;
error:
return CMD_SUCCESS;
error:
+ lttng_destroy_handle(handle);
return -1;
}
return -1;
}
@@
-295,6
+300,8
@@
static int list_kernel_events(void)
struct lttng_handle *handle;
struct lttng_event *event_list;
struct lttng_handle *handle;
struct lttng_event *event_list;
+ memset(&domain, 0, sizeof(domain));
+
DBG("Getting kernel tracing events");
domain.type = LTTNG_DOMAIN_KERNEL;
DBG("Getting kernel tracing events");
domain.type = LTTNG_DOMAIN_KERNEL;
@@
-307,6
+314,7
@@
static int list_kernel_events(void)
size = lttng_list_tracepoints(handle, &event_list);
if (size < 0) {
ERR("Unable to list kernel events");
size = lttng_list_tracepoints(handle, &event_list);
if (size < 0) {
ERR("Unable to list kernel events");
+ lttng_destroy_handle(handle);
return size;
}
return size;
}
@@
-320,9
+328,11
@@
static int list_kernel_events(void)
free(event_list);
free(event_list);
+ lttng_destroy_handle(handle);
return CMD_SUCCESS;
error:
return CMD_SUCCESS;
error:
+ lttng_destroy_handle(handle);
return -1;
}
return -1;
}
@@
-556,6
+566,8
@@
int cmd_list(int argc, const char **argv)
struct lttng_domain domain;
struct lttng_domain *domains = NULL;
struct lttng_domain domain;
struct lttng_domain *domains = NULL;
+ memset(&domain, 0, sizeof(domain));
+
if (argc < 1) {
usage(stderr);
ret = CMD_ERROR;
if (argc < 1) {
usage(stderr);
ret = CMD_ERROR;
@@
-594,10
+606,12
@@
int cmd_list(int argc, const char **argv)
domain.type = LTTNG_DOMAIN_UST;
}
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 (session_name == NULL) {
@@
-660,7
+674,9
@@
int cmd_list(int argc, const char **argv)
}
/* 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) {
@@
-680,7
+696,9
@@
end:
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;
This page took
0.024828 seconds
and
4
git commands to generate.