projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: Memory leaks when calling get_cmdline_by_pid
[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 8fec91fac30ffe6cab6986ac7e717a75dbf18d36..5429df4e2eacc9dbdc1c1b1186999046b3732309 100644
(file)
--- a/
src/bin/lttng/commands/list.c
+++ b/
src/bin/lttng/commands/list.c
@@
-294,6
+294,7
@@
static int list_ust_events(void)
struct lttng_handle *handle;
struct lttng_event *event_list;
pid_t cur_pid = 0;
struct lttng_handle *handle;
struct lttng_event *event_list;
pid_t cur_pid = 0;
+ char *cmdline = NULL;
memset(&domain, 0, sizeof(domain));
memset(&domain, 0, sizeof(domain));
@@
-322,7
+323,9
@@
static int list_ust_events(void)
for (i = 0; i < size; i++) {
if (cur_pid != event_list[i].pid) {
cur_pid = event_list[i].pid;
for (i = 0; i < size; i++) {
if (cur_pid != event_list[i].pid) {
cur_pid = event_list[i].pid;
- MSG("\nPID: %d - Name: %s", cur_pid, get_cmdline_by_pid(cur_pid));
+ cmdline = get_cmdline_by_pid(cur_pid);
+ MSG("\nPID: %d - Name: %s", cur_pid, cmdline);
+ free(cmdline);
}
print_events(&event_list[i]);
}
}
print_events(&event_list[i]);
}
@@
-349,6
+352,8
@@
static int list_ust_event_fields(void)
struct lttng_handle *handle;
struct lttng_event_field *event_field_list;
pid_t cur_pid = 0;
struct lttng_handle *handle;
struct lttng_event_field *event_field_list;
pid_t cur_pid = 0;
+ char *cmdline = NULL;
+
struct lttng_event cur_event;
memset(&domain, 0, sizeof(domain));
struct lttng_event cur_event;
memset(&domain, 0, sizeof(domain));
@@
-379,7
+384,9
@@
static int list_ust_event_fields(void)
for (i = 0; i < size; i++) {
if (cur_pid != event_field_list[i].event.pid) {
cur_pid = event_field_list[i].event.pid;
for (i = 0; i < size; i++) {
if (cur_pid != event_field_list[i].event.pid) {
cur_pid = event_field_list[i].event.pid;
- MSG("\nPID: %d - Name: %s", cur_pid, get_cmdline_by_pid(cur_pid));
+ cmdline = get_cmdline_by_pid(cur_pid);
+ MSG("\nPID: %d - Name: %s", cur_pid, cmdline);
+ free(cmdline);
}
if (strcmp(cur_event.name, event_field_list[i].event.name) != 0) {
print_events(&event_field_list[i].event);
}
if (strcmp(cur_event.name, event_field_list[i].event.name) != 0) {
print_events(&event_field_list[i].event);
This page took
0.0230860000000001 seconds
and
4
git commands to generate.