X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=dafe085dc9bc40b81f53a35b13fbc6791969492f;hp=1d92facf05cf866ee757a0acc247b5f0225e8b0c;hb=441c16a7f0bbab56a5e783059d0cddab68544a9a;hpb=22e25b7152253d44385314fc7cdc5faa4e11e30f diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 1d92facf0..dafe085dc 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -74,6 +74,7 @@ static void copy_lttng_domain(struct lttng_domain *dst, struct lttng_domain *src memcpy(dst, src, sizeof(struct lttng_domain)); break; default: + memset(dst, 0, sizeof(struct lttng_domain)); dst->type = LTTNG_DOMAIN_KERNEL; break; } @@ -484,6 +485,8 @@ int lttng_add_context(struct lttng_handle *handle, return -1; } + memset(&lsm, 0, sizeof(lsm)); + lsm.cmd_type = LTTNG_ADD_CONTEXT; /* Copy channel name */ @@ -518,6 +521,8 @@ int lttng_enable_event(struct lttng_handle *handle, return -1; } + memset(&lsm, 0, sizeof(lsm)); + /* If no channel name, we put the default name */ if (channel_name == NULL) { copy_string(lsm.u.enable.channel_name, DEFAULT_CHANNEL_NAME, @@ -557,6 +562,8 @@ int lttng_disable_event(struct lttng_handle *handle, const char *name, return -1; } + memset(&lsm, 0, sizeof(lsm)); + if (channel_name) { copy_string(lsm.u.disable.channel_name, channel_name, sizeof(lsm.u.disable.channel_name)); @@ -596,6 +603,8 @@ int lttng_enable_channel(struct lttng_handle *handle, return -1; } + memset(&lsm, 0, sizeof(lsm)); + memcpy(&lsm.u.channel.chan, chan, sizeof(lsm.u.channel.chan)); lsm.cmd_type = LTTNG_ENABLE_CHANNEL; @@ -621,6 +630,8 @@ int lttng_disable_channel(struct lttng_handle *handle, const char *name) return -1; } + memset(&lsm, 0, sizeof(lsm)); + lsm.cmd_type = LTTNG_DISABLE_CHANNEL; copy_string(lsm.u.disable.channel_name, name, @@ -861,11 +872,13 @@ int lttng_calibrate(struct lttng_handle *handle, /* * Set default channel attributes. - * If either or both of the arguments are null, nothing happens. + * If either or both of the arguments are null, attr content is zeroe'd. */ void lttng_channel_set_default_attr(struct lttng_domain *domain, struct lttng_channel_attr *attr) { + memset(attr, 0, sizeof(struct lttng_channel_attr)); + /* Safety check */ if (attr == NULL || domain == NULL) { return; @@ -896,8 +909,7 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain, attr->output = DEFAULT_UST_CHANNEL_OUTPUT; break; default: - /* Default behavior */ - memset(attr, 0, sizeof(struct lttng_channel_attr)); + /* Default behavior: leave set to 0. */ break; } }