projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: Add missing free() in spawn_viewer
[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 6d75104811f8cf8bfdb15fc8280b9ef39b957579..bcf2f0a5f0b44e5bc7c4cd36746d94c9adc33d92 100644
(file)
--- a/
src/bin/lttng/commands/list.c
+++ b/
src/bin/lttng/commands/list.c
@@
-24,6
+24,7
@@
#include <assert.h>
#include <common/mi-lttng.h>
#include <assert.h>
#include <common/mi-lttng.h>
+#include <lttng/constant.h>
#include "../command.h"
#include "../command.h"
@@
-116,7
+117,8
@@
static char *get_cmdline_by_pid(pid_t pid)
int ret;
FILE *fp = NULL;
char *cmdline = NULL;
int ret;
FILE *fp = NULL;
char *cmdline = NULL;
- char path[20]; /* Can't go bigger than /proc/65535/cmdline */
+ /* Can't go bigger than /proc/LTTNG_MAX_PID/cmdline */
+ char path[sizeof("/proc//cmdline") + sizeof(LTTNG_MAX_PID_STR) - 1];
snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
fp = fopen(path, "r");
snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
fp = fopen(path, "r");
@@
-416,8
+418,8
@@
static int list_agent_events(void)
{
int i, size, ret = CMD_SUCCESS;
struct lttng_domain domain;
{
int i, size, ret = CMD_SUCCESS;
struct lttng_domain domain;
- struct lttng_handle *handle;
- struct lttng_event *event_list;
+ struct lttng_handle *handle
= NULL
;
+ struct lttng_event *event_list
= NULL
;
pid_t cur_pid = 0;
char *cmdline = NULL;
const char *agent_domain_str;
pid_t cur_pid = 0;
char *cmdline = NULL;
const char *agent_domain_str;
@@
-427,6
+429,10
@@
static int list_agent_events(void)
domain.type = LTTNG_DOMAIN_JUL;
} else if (opt_log4j) {
domain.type = LTTNG_DOMAIN_LOG4J;
domain.type = LTTNG_DOMAIN_JUL;
} else if (opt_log4j) {
domain.type = LTTNG_DOMAIN_LOG4J;
+ } else {
+ ERR("Invalid agent domain selected.");
+ ret = CMD_ERROR;
+ goto error;
}
agent_domain_str = get_domain_str(domain.type);
}
agent_domain_str = get_domain_str(domain.type);
@@
-495,7
+501,7
@@
static int list_ust_events(void)
int i, size, ret = CMD_SUCCESS;
struct lttng_domain domain;
struct lttng_handle *handle;
int i, size, ret = CMD_SUCCESS;
struct lttng_domain domain;
struct lttng_handle *handle;
- struct lttng_event *event_list;
+ struct lttng_event *event_list
= NULL
;
pid_t cur_pid = 0;
char *cmdline = NULL;
pid_t cur_pid = 0;
char *cmdline = NULL;
This page took
0.05159 seconds
and
4
git commands to generate.