Initialize all stack variables to zero, fix uninitialized loglevel variables
[lttng-tools.git] / src / bin / lttng / commands / add_context.c
index a1d776d6cbb46da28b4128fd8d2d5fcacb27bf92..e499ef3d37894eb3aababec3d4ad59c18abbd964 100644 (file)
@@ -369,6 +369,9 @@ static int add_context(char *session_name)
        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) {
@@ -512,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) {
This page took 0.02774 seconds and 4 git commands to generate.