X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Fchannel.cpp;h=d1d92d00d5497b9f8cdf27525b2db9591e9f678a;hb=63ae8472c752d86217fb28671ea9e9199fdca993;hp=080dbb4439659a33c10dc052e81f21b56251b4c9;hpb=c9e313bc594f40a86eed237dce222c0fc99c957f;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/channel.cpp b/src/lib/lttng-ctl/channel.cpp index 080dbb443..d1d92d00d 100644 --- a/src/lib/lttng-ctl/channel.cpp +++ b/src/lib/lttng-ctl/channel.cpp @@ -53,6 +53,10 @@ int receive_message(struct lttng_notification_channel *channel) goto error; } + if (msg.size == 0) { + goto skip_payload; + } + /* Reserve space for the payload. */ ret = lttng_dynamic_buffer_set_size(&channel->reception_payload.buffer, channel->reception_payload.buffer.size + msg.size); @@ -68,6 +72,7 @@ int receive_message(struct lttng_notification_channel *channel) goto error; } +skip_payload: /* Receive message fds. */ if (msg.fds != 0) { ret = lttcomm_recv_payload_fds_unix_sock(channel->socket, @@ -143,12 +148,12 @@ struct lttng_notification_channel *lttng_notification_channel_create( goto end; } - sock_path = (char *) zmalloc(LTTNG_PATH_MAX); + sock_path = calloc(LTTNG_PATH_MAX); if (!sock_path) { goto end; } - channel = (lttng_notification_channel *) zmalloc(sizeof(struct lttng_notification_channel)); + channel = zmalloc(); if (!channel) { goto end; } @@ -343,7 +348,7 @@ int enqueue_dropped_notification( goto end; } - pending_notification = (struct pending_notification *) zmalloc(sizeof(*pending_notification)); + pending_notification = zmalloc(); if (!pending_notification) { ret = -1; goto end; @@ -371,7 +376,7 @@ int enqueue_notification_from_current_message( goto end; } - pending_notification = (struct pending_notification *) zmalloc(sizeof(*pending_notification)); + pending_notification = zmalloc(); if (!pending_notification) { ret = -1; goto error;