Initialize command header to zero
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index 72232122c7a6c2a875124ec569e9b03f7ac9544f..dbd99cc637659e242c1012cd6717f20b4e0a36d4 100644 (file)
@@ -3844,19 +3844,19 @@ error_add_context:
        }
        case LTTNG_LIST_CHANNELS:
        {
-               int nb_chan;
+               ssize_t payload_size;
                struct lttng_channel *channels = NULL;
 
-               nb_chan = cmd_list_channels(cmd_ctx->lsm->domain.type,
+               payload_size = cmd_list_channels(cmd_ctx->lsm->domain.type,
                                cmd_ctx->session, &channels);
-               if (nb_chan < 0) {
+               if (payload_size < 0) {
                        /* Return value is a negative lttng_error_code. */
-                       ret = -nb_chan;
+                       ret = -payload_size;
                        goto error;
                }
 
                ret = setup_lttng_msg_no_cmd_header(cmd_ctx, channels,
-                       nb_chan * sizeof(struct lttng_channel));
+                       payload_size);
                free(channels);
 
                if (ret < 0) {
@@ -3873,6 +3873,7 @@ error_add_context:
                struct lttcomm_event_command_header cmd_header;
                size_t total_size;
 
+               memset(&cmd_header, 0, sizeof(cmd_header));
                /* Extended infos are included at the end of events */
                nb_event = cmd_list_events(cmd_ctx->lsm->domain.type,
                        cmd_ctx->session, cmd_ctx->lsm->u.list.channel_name,
This page took 0.023145 seconds and 4 git commands to generate.