X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.cpp;h=aea78167160be7abc349758af1ad776d45b3c988;hb=f370852feddd5554281c3ce60d7fa3dfeb8869a1;hp=47c049b319ed9a9f3dbc31f4dda935f8ff31007d;hpb=c9e313bc594f40a86eed237dce222c0fc99c957f;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.cpp b/src/bin/lttng-sessiond/cmd.cpp index 47c049b31..aea781671 100644 --- a/src/bin/lttng-sessiond/cmd.cpp +++ b/src/bin/lttng-sessiond/cmd.cpp @@ -2140,7 +2140,7 @@ static int _cmd_enable_event(struct ltt_session *session, } } if (filter) { - filter_a = (lttng_bytecode *) zmalloc(sizeof(*filter_a) + filter->len); + filter_a = zmalloc(sizeof(*filter_a) + filter->len); if (!filter_a) { free(filter_expression_a); ret = LTTNG_ERR_FATAL; @@ -2368,7 +2368,7 @@ static int _cmd_enable_event(struct ltt_session *session, struct lttng_bytecode) + filter->len; - filter_copy = (lttng_bytecode *) zmalloc(filter_size); + filter_copy = zmalloc(filter_size); if (!filter_copy) { ret = LTTNG_ERR_NOMEM; goto error; @@ -3380,11 +3380,12 @@ int cmd_destroy_session(struct ltt_session *session, struct cmd_destroy_session_reply_context *reply_context = NULL; if (sock_fd) { - reply_context = (cmd_destroy_session_reply_context *) zmalloc(sizeof(*reply_context)); + reply_context = zmalloc(); if (!reply_context) { ret = LTTNG_ERR_NOMEM; goto end; } + reply_context->reply_sock_fd = *sock_fd; } @@ -3583,12 +3584,13 @@ int cmd_register_consumer(struct ltt_session *session, goto error; } - socket->lock = (pthread_mutex_t *) zmalloc(sizeof(pthread_mutex_t)); + socket->lock = zmalloc(); if (socket->lock == NULL) { PERROR("zmalloc pthread mutex"); ret = LTTNG_ERR_FATAL; goto error; } + pthread_mutex_init(socket->lock, NULL); socket->registered = 1; @@ -3651,7 +3653,7 @@ ssize_t cmd_list_domains(struct ltt_session *session, goto end; } - *domains = (lttng_domain *) zmalloc(nb_dom * sizeof(struct lttng_domain)); + *domains = calloc(nb_dom); if (*domains == NULL) { ret = LTTNG_ERR_FATAL; goto error; @@ -4193,7 +4195,7 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session, goto end; } - list = (lttng_snapshot_output *) zmalloc(session->snapshot.nb_output * sizeof(*list)); + list = calloc(session->snapshot.nb_output); if (!list) { ret = -LTTNG_ERR_NOMEM; goto end; @@ -4359,6 +4361,8 @@ int ust_regenerate_metadata(struct ltt_ust_session *usess) struct ust_registry_event *event; struct lttng_ht_iter iter_event; + chan->metadata_dumped = 0; + ret = ust_metadata_channel_statedump(registry, chan); if (ret) { pthread_mutex_unlock(®istry->lock); @@ -4366,8 +4370,9 @@ int ust_regenerate_metadata(struct ltt_ust_session *usess) "(err = %d)", ret); goto end; } - cds_lfht_for_each_entry(chan->ht->ht, &iter_event.iter, - event, node.node) { + cds_lfht_for_each_entry(chan->events->ht, &iter_event.iter, + event, node.node) { + event->metadata_dumped = 0; ret = ust_metadata_event_statedump(registry, chan, event); if (ret) {