Fix: Revert of 814b4934e2604a419bcb8eec57c0450dbb47e2c3
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.cpp
index 47c049b319ed9a9f3dbc31f4dda935f8ff31007d..aea78167160be7abc349758af1ad776d45b3c988 100644 (file)
@@ -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<lttng_bytecode>(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<lttng_bytecode>(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<cmd_destroy_session_reply_context>();
                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<pthread_mutex_t>();
                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<lttng_domain>(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<lttng_snapshot_output>(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(&registry->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) {
This page took 0.024885 seconds and 4 git commands to generate.