projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Initialize all stack variables to zero, fix uninitialized loglevel variables
[lttng-tools.git]
/
src
/
bin
/
lttng
/
commands
/
add_context.c
diff --git
a/src/bin/lttng/commands/add_context.c
b/src/bin/lttng/commands/add_context.c
index ce65024f5f6b912cbf2406d8be8e82018c2b9e90..e499ef3d37894eb3aababec3d4ad59c18abbd964 100644
(file)
--- a/
src/bin/lttng/commands/add_context.c
+++ b/
src/bin/lttng/commands/add_context.c
@@
-369,6
+369,9
@@
static int add_context(char *session_name)
struct ctx_type *type;
char *ptr;
struct ctx_type *type;
char *ptr;
+ memset(&context, 0, sizeof(context));
+ memset(&dom, 0, sizeof(dom));
+
if (opt_kernel) {
dom.type = LTTNG_DOMAIN_KERNEL;
} else if (opt_userspace) {
if (opt_kernel) {
dom.type = LTTNG_DOMAIN_KERNEL;
} else if (opt_userspace) {
@@
-466,7
+469,6
@@
int cmd_add_context(int argc, const char **argv)
switch (opt) {
case OPT_HELP:
usage(stdout);
switch (opt) {
case OPT_HELP:
usage(stdout);
- ret = CMD_SUCCESS;
goto end;
case OPT_TYPE:
/*
goto end;
case OPT_TYPE:
/*
@@
-505,7
+507,6
@@
int cmd_add_context(int argc, const char **argv)
break;
case OPT_LIST_OPTIONS:
list_cmd_options(stdout, long_options);
break;
case OPT_LIST_OPTIONS:
list_cmd_options(stdout, long_options);
- ret = CMD_SUCCESS;
goto end;
default:
usage(stderr);
goto end;
default:
usage(stderr);
@@
-514,6
+515,13
@@
int cmd_add_context(int argc, const char **argv)
}
}
}
}
+ if (!opt_type) {
+ ERR("Missing mandatory -t TYPE");
+ usage(stderr);
+ ret = CMD_ERROR;
+ goto end;
+ }
+
if (!opt_session_name) {
session_name = get_session_name();
if (session_name == NULL) {
if (!opt_session_name) {
session_name = get_session_name();
if (session_name == NULL) {
@@
-532,5
+540,6
@@
end:
free(type);
}
free(type);
}
+ poptFreeContext(pc);
return ret;
}
return ret;
}
This page took
0.024159 seconds
and
4
git commands to generate.