X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconsumer%2Fconsumer.cpp;h=9393e6cc29af21a8c3b8072ffd42eb6a0ae14b3e;hb=64803277bbdbe0a943360d918298a48157d9da55;hp=685d55f838120a4b94cf407d9e420e03cf294e32;hpb=60f1b42d6280b6bd386abb726dca4fd3b31d8491;p=lttng-tools.git diff --git a/src/common/consumer/consumer.cpp b/src/common/consumer/consumer.cpp index 685d55f83..9393e6cc2 100644 --- a/src/common/consumer/consumer.cpp +++ b/src/common/consumer/consumer.cpp @@ -662,7 +662,7 @@ static struct consumer_relayd_sock_pair *consumer_allocate_relayd_sock_pair( goto error; } - obj = (consumer_relayd_sock_pair *) zmalloc(sizeof(struct consumer_relayd_sock_pair)); + obj = zmalloc(); if (obj == NULL) { PERROR("zmalloc relayd sock"); goto error; @@ -1029,7 +1029,7 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key, } } - channel = (lttng_consumer_channel *) zmalloc(sizeof(*channel)); + channel = zmalloc(); if (channel == NULL) { PERROR("malloc struct lttng_consumer_channel"); goto end; @@ -1425,7 +1425,7 @@ struct lttng_consumer_local_data *lttng_consumer_create( the_consumer_data.type == type); the_consumer_data.type = type; - ctx = (lttng_consumer_local_data *) zmalloc(sizeof(struct lttng_consumer_local_data)); + ctx = zmalloc(); if (ctx == NULL) { PERROR("allocating context"); goto error; @@ -2561,7 +2561,7 @@ void *consumer_thread_data_poll(void *data) health_code_update(); - local_stream = (lttng_consumer_stream **) zmalloc(sizeof(struct lttng_consumer_stream *)); + local_stream = zmalloc(); if (local_stream == NULL) { PERROR("local_stream malloc"); goto end; @@ -2586,18 +2586,14 @@ void *consumer_thread_data_poll(void *data) local_stream = NULL; /* Allocate for all fds */ - pollfd = (struct pollfd *) zmalloc((the_consumer_data.stream_count + - nb_pipes_fd) * - sizeof(struct pollfd)); + pollfd = calloc(the_consumer_data.stream_count + nb_pipes_fd); if (pollfd == NULL) { PERROR("pollfd malloc"); pthread_mutex_unlock(&the_consumer_data.lock); goto end; } - local_stream = (lttng_consumer_stream **) zmalloc((the_consumer_data.stream_count + - nb_pipes_fd) * - sizeof(struct lttng_consumer_stream *)); + local_stream = calloc(the_consumer_data.stream_count + nb_pipes_fd); if (local_stream == NULL) { PERROR("local_stream malloc"); pthread_mutex_unlock(&the_consumer_data.lock);