X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.cpp;fp=src%2Flib%2Flttng-ctl%2Flttng-ctl.cpp;h=057a91e3e57f73f0b0afc5fd26e8c9f731efbb1e;hp=c5d47ebdc53d66b2182a6656b2ecb955fdf91942;hb=64803277bbdbe0a943360d918298a48157d9da55;hpb=60f1b42d6280b6bd386abb726dca4fd3b31d8491 diff --git a/src/lib/lttng-ctl/lttng-ctl.cpp b/src/lib/lttng-ctl/lttng-ctl.cpp index c5d47ebdc..057a91e3e 100644 --- a/src/lib/lttng-ctl/lttng-ctl.cpp +++ b/src/lib/lttng-ctl/lttng-ctl.cpp @@ -266,7 +266,7 @@ int lttng_check_tracing_group(void) } /* Alloc group list of the right size */ - grp_list = (gid_t *) zmalloc(grp_list_size * sizeof(gid_t)); + grp_list = calloc(grp_list_size); if (!grp_list) { PERROR("malloc"); goto end; @@ -500,7 +500,7 @@ static int recv_sessiond_optional_data(size_t len, void **user_buf, size_t *user_len) { int ret = 0; - void *buf = NULL; + char *buf = NULL; if (len) { if (!user_len) { @@ -508,7 +508,7 @@ static int recv_sessiond_optional_data(size_t len, void **user_buf, goto end; } - buf = zmalloc(len); + buf = zmalloc(len); if (!buf) { ret = -ENOMEM; goto end; @@ -729,7 +729,7 @@ struct lttng_handle *lttng_create_handle(const char *session_name, int ret; struct lttng_handle *handle = NULL; - handle = (lttng_handle *) zmalloc(sizeof(struct lttng_handle)); + handle = zmalloc(); if (handle == NULL) { PERROR("malloc handle"); goto end; @@ -1576,13 +1576,13 @@ int lttng_enable_channel(struct lttng_handle *handle, /* Populate the channel extended attribute if necessary. */ if (!channel->attr.extended.ptr) { struct lttng_channel_extended *extended = - (struct lttng_channel_extended *) zmalloc( - sizeof(*extended)); + zmalloc(); if (!extended) { ret = -LTTNG_ERR_NOMEM; goto end; } + lttng_channel_set_default_extended_attr( &handle->domain, extended); channel->attr.extended.ptr = extended;