X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=3bc709a68ad2deeb573584297146f468277e8643;hb=46f44e2a0813922f2687464d6190d663e56c2711;hp=61396eb461958b179f5975f1e19f3739da13bac9;hpb=9804676e1f70fc75b2ba0938f496e262626d5514;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 61396eb46..3bc709a68 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -736,9 +736,16 @@ int lttng_add_context(struct lttng_handle *handle, memcpy(buf + provider_len, ctx_name, ctx_len); } memcpy(&lsm.u.context.ctx, ctx, sizeof(struct lttng_event_context)); - /* Don't leak application addresses to the sessiond. */ - lsm.u.context.ctx.u.app_ctx.provider_name = NULL; - lsm.u.context.ctx.u.app_ctx.ctx_name = NULL; + + if (ctx->ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT) { + /* + * Don't leak application addresses to the sessiond. + * This is only necessary when ctx is for an app ctx otherwise + * the values inside the union (type & config) are overwritten. + */ + lsm.u.context.ctx.u.app_ctx.provider_name = NULL; + lsm.u.context.ctx.u.app_ctx.ctx_name = NULL; + } ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, buf, len, NULL); end: