A failure path in trace_chunk_registry_ht_element_create() does not
destroy a newly created chunk registry, resulting in a leak.
The ownership of the registry is transfered to the element being
created as soon as possible. Error paths that release the reference on
the new element will then naturally clean-up the trace chunk registry.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
urcu_ref_init(&new_element->ref);
cds_lfht_node_init(&new_element->ht_node);
new_element->trace_chunk_registry = trace_chunk_registry;
+ trace_chunk_registry = NULL;
/* Attempt to publish the new element. */
rcu_read_lock();
ERR("Failed to create trace chunk registry for session daemon {%s}",
uuid_str);
}
+ lttng_trace_chunk_registry_destroy(trace_chunk_registry);
return ret;
}