X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-registry.c;h=e22fc6fcfbfc93246172db98e398be6783b99285;hb=a1dcaf0fdbfbaf02ef38886b556c3d37e4458fdc;hp=6e9f0699b334bbeebb00957b0e9a9b0bd486ea1b;hpb=0b2dc8df2a6d7b3341a72a04767dd6328907c97c;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-registry.c b/src/bin/lttng-sessiond/ust-registry.c index 6e9f0699b..e22fc6fcf 100644 --- a/src/bin/lttng-sessiond/ust-registry.c +++ b/src/bin/lttng-sessiond/ust-registry.c @@ -198,34 +198,34 @@ int ust_registry_create_event(struct ust_registry_session *session, assert(sig); assert(event_id_p); + rcu_read_lock(); + /* * This should not happen but since it comes from the UST tracer, an * external party, don't assert and simply validate values. */ if (session_objd < 0 || channel_objd < 0) { ret = -EINVAL; - goto error; + goto error_free; } - rcu_read_lock(); - chan = ust_registry_channel_find(session, chan_key); if (!chan) { ret = -EINVAL; - goto error_unlock; + goto error_free; } /* Check if we've reached the maximum possible id. */ if (ust_registry_is_max_id(chan->used_event_id)) { ret = -ENOENT; - goto error_unlock; + goto error_free; } event = alloc_event(session_objd, channel_objd, name, sig, nr_fields, fields, loglevel, model_emf_uri); if (!event) { ret = -ENOMEM; - goto error_unlock; + goto error_free; } DBG3("UST registry creating event with event: %s, sig: %s, id: %u, " @@ -279,9 +279,12 @@ int ust_registry_create_event(struct ust_registry_session *session, rcu_read_unlock(); return 0; +error_free: + free(sig); + free(fields); + free(model_emf_uri); error_unlock: rcu_read_unlock(); -error: destroy_event(event); return ret; } @@ -324,6 +327,7 @@ void destroy_channel_rcu(struct rcu_head *head) if (chan->ht) { ht_cleanup_push(chan->ht); } + free(chan->ctx_fields); free(chan); } @@ -552,8 +556,6 @@ void ust_registry_session_destroy(struct ust_registry_session *reg) } rcu_read_unlock(); - if (reg->channels) { - ht_cleanup_push(reg->channels); - } + ht_cleanup_push(reg->channels); free(reg->metadata); }