}
/* Alloc group list of the right size */
- grp_list = (gid_t *) zmalloc(grp_list_size * sizeof(gid_t));
+ grp_list = calloc<gid_t>(grp_list_size);
if (!grp_list) {
PERROR("malloc");
goto end;
size_t *user_len)
{
int ret = 0;
- void *buf = NULL;
+ char *buf = NULL;
if (len) {
if (!user_len) {
goto end;
}
- buf = zmalloc(len);
+ buf = zmalloc<char>(len);
if (!buf) {
ret = -ENOMEM;
goto end;
int ret;
struct lttng_handle *handle = NULL;
- handle = (lttng_handle *) zmalloc(sizeof(struct lttng_handle));
+ handle = zmalloc<lttng_handle>();
if (handle == NULL) {
PERROR("malloc handle");
goto end;
/* 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<lttng_channel_extended>();
if (!extended) {
ret = -LTTNG_ERR_NOMEM;
goto end;
}
+
lttng_channel_set_default_extended_attr(
&handle->domain, extended);
channel->attr.extended.ptr = extended;
unsigned int nb_event_fields = 0;
struct lttng_payload reply;
+ lttng_payload_init(&reply);
+
if (handle == NULL) {
ret = -LTTNG_ERR_INVALID;
goto end;
}
- lttng_payload_init(&reply);
-
memset(&lsm, 0, sizeof(lsm));
lsm.cmd_type = LTTNG_LIST_TRACEPOINT_FIELDS;
COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
ret = nb_event_fields;
end:
+ lttng_payload_reset(&reply);
return ret;
}