free(trace);
}
+static void rcu_destroy_stream(struct rcu_head *head)
+{
+ struct relay_stream *stream =
+ caa_container_of(head, struct relay_stream, rcu_node);
+
+ stream_destroy(stream);
+}
+
/*
* Destroy a ctf trace and all stream contained in it.
*
cds_list_for_each_entry_safe(stream, tmp_stream, &obj->stream_list,
trace_list) {
stream_delete(relay_streams_ht, stream);
- stream_destroy(stream);
+ call_rcu(&stream->rcu_node, rcu_destroy_stream);
}
call_rcu(&obj->node.head, rcu_destroy_ctf_trace);
if (ret < 0) {
reply.ret_code = htobe32(LTTNG_ERR_UNK);
/* stream was not properly added to the ht, so free it */
- free(stream);
+ stream_destroy(stream);
} else {
reply.ret_code = htobe32(LTTNG_OK);
}
return ret;
err_free_stream:
- free(stream->path_name);
- free(stream->channel_name);
- free(stream);
+ stream_destroy(stream);
return ret;
}
#include "stream.h"
#include "viewer-stream.h"
-static void rcu_destroy_stream(struct rcu_head *head)
-{
- struct relay_stream *stream =
- caa_container_of(head, struct relay_stream, rcu_node);
-
- free(stream->path_name);
- free(stream->channel_name);
- free(stream);
-}
-
/*
* Get stream from stream id from the given hash table. Return stream if found
* else NULL.
void stream_destroy(struct relay_stream *stream)
{
assert(stream);
-
- call_rcu(&stream->rcu_node, rcu_destroy_stream);
+ free(stream->path_name);
+ free(stream->channel_name);
+ free(stream);
}