X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng-sessiond%2Fust-consumer.c;h=df569368ae04f2e8faafb1b9ebbfde069fc618aa;hp=ca008d4adf65d0165d3eaca6f06f149361081594;hb=d80a6244b0e8dc14b2912e72e94ff0848bb52ccc;hpb=3a009adbd8bf5305668e7e41e5e9f12813d04959 diff --git a/lttng-sessiond/ust-consumer.c b/lttng-sessiond/ust-consumer.c index ca008d4ad..df569368a 100644 --- a/lttng-sessiond/ust-consumer.c +++ b/lttng-sessiond/ust-consumer.c @@ -38,7 +38,7 @@ static int send_channel_streams(int sock, { int ret, fd; struct lttcomm_consumer_msg lum; - struct ltt_ust_stream *stream; + struct ltt_ust_stream *stream, *tmp; DBG("Sending streams of channel %s to UST consumer", uchan->name); @@ -65,7 +65,7 @@ static int send_channel_streams(int sock, goto error; } - cds_list_for_each_entry(stream, &uchan->streams.head, list) { + cds_list_for_each_entry_safe(stream, tmp, &uchan->streams.head, list) { int fds[2]; if (!stream->obj->shm_fd) { @@ -97,7 +97,18 @@ static int send_channel_streams(int sock, perror("send consumer stream ancillary data"); goto error; } + + /* + * We release the stream object here, as we have passed + * it to the consumer. + */ + /* Ensure we don't let the app know (sock = -1). */ + ustctl_release_object(-1, stream->obj); + cds_list_del(&stream->list); + free(stream); } + /* Ensure we don't let the app know (sock = -1). */ + ustctl_release_object(-1, uchan->obj); DBG("consumer channel streams sent"); @@ -165,6 +176,10 @@ int ust_consumer_send_session(int consumer_fd, struct ust_app_session *usess) perror("send consumer stream"); goto error; } + /* Metadata fds passed to consumer, release them. */ + /* Ensure we don't let the app know (sock = -1). */ + ustctl_release_object(-1, usess->metadata->stream_obj); + ustctl_release_object(-1, usess->metadata->obj); } /* Send each channel fd streams of session */