Fix: liblttng-ctl comm: lttng_event_context is not packed
[deliverable/lttng-tools.git] / src / bin / lttng-sessiond / client.c
index 0d56e42f5da6cd70a1b7ab26a8aa5d3339e21980..d6de4bfbd2fbe202ce119b553041a7056255a1f9 100644 (file)
@@ -981,74 +981,7 @@ skip_domain:
        switch (cmd_ctx->lsm->cmd_type) {
        case LTTNG_ADD_CONTEXT:
        {
-               /*
-                * An LTTNG_ADD_CONTEXT command might have a supplementary
-                * payload if the context being added is an application context.
-                */
-               if (cmd_ctx->lsm->u.context.ctx.ctx ==
-                               LTTNG_EVENT_CONTEXT_APP_CONTEXT) {
-                       char *provider_name = NULL, *context_name = NULL;
-                       size_t provider_name_len =
-                                       cmd_ctx->lsm->u.context.provider_name_len;
-                       size_t context_name_len =
-                                       cmd_ctx->lsm->u.context.context_name_len;
-
-                       if (provider_name_len == 0 || context_name_len == 0) {
-                               /*
-                                * Application provider and context names MUST
-                                * be provided.
-                                */
-                               ret = -LTTNG_ERR_INVALID;
-                               goto error;
-                       }
-
-                       provider_name = zmalloc(provider_name_len + 1);
-                       if (!provider_name) {
-                               ret = -LTTNG_ERR_NOMEM;
-                               goto error;
-                       }
-                       cmd_ctx->lsm->u.context.ctx.u.app_ctx.provider_name =
-                                       provider_name;
-
-                       context_name = zmalloc(context_name_len + 1);
-                       if (!context_name) {
-                               ret = -LTTNG_ERR_NOMEM;
-                               goto error_add_context;
-                       }
-                       cmd_ctx->lsm->u.context.ctx.u.app_ctx.ctx_name =
-                                       context_name;
-
-                       ret = lttcomm_recv_unix_sock(*sock, provider_name,
-                                       provider_name_len);
-                       if (ret < 0) {
-                               goto error_add_context;
-                       }
-
-                       ret = lttcomm_recv_unix_sock(*sock, context_name,
-                                       context_name_len);
-                       if (ret < 0) {
-                               goto error_add_context;
-                       }
-               }
-
-               /*
-                * cmd_add_context assumes ownership of the provider and context
-                * names.
-                */
-               ret = cmd_add_context(cmd_ctx->session,
-                               cmd_ctx->lsm->domain.type,
-                               cmd_ctx->lsm->u.context.channel_name,
-                               ALIGNED_CONST_PTR(cmd_ctx->lsm->u.context.ctx),
-                               kernel_poll_pipe[1]);
-
-               cmd_ctx->lsm->u.context.ctx.u.app_ctx.provider_name = NULL;
-               cmd_ctx->lsm->u.context.ctx.u.app_ctx.ctx_name = NULL;
-error_add_context:
-               free(cmd_ctx->lsm->u.context.ctx.u.app_ctx.provider_name);
-               free(cmd_ctx->lsm->u.context.ctx.u.app_ctx.ctx_name);
-               if (ret < 0) {
-                       goto error;
-               }
+               ret = cmd_add_context(cmd_ctx, *sock, kernel_poll_pipe[1]);
                break;
        }
        case LTTNG_DISABLE_CHANNEL:
This page took 0.027157 seconds and 5 git commands to generate.