[lttng-dev] [PATCH babeltrace] Fix: don't access missing ctf trace when getting metadata
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Mon Aug 17 21:58:23 EDT 2015
----- On Aug 17, 2015, at 5:50 PM, Jeremie Galarneau <jeremie.galarneau at efficios.com> wrote:
> On Mon, Aug 17, 2015 at 7:53 PM, Mathieu Desnoyers <
> mathieu.desnoyers at efficios.com > wrote:
>> We can get metadata when still in the trace open functions, in which
>> case the ctf trace is now allocated nor available yet. This fixes a
> Do you mean "is neither allocated nor available yet"?
yes, sorry.
Thanks,
Mathieu
>> segmentation fault in stress-test.
>> Signed-off-by: Mathieu Desnoyers < mathieu.desnoyers at efficios.com >
>> ---
>> formats/lttng-live/lttng-live-comm.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>> diff --git a/formats/lttng-live/lttng-live-comm.c
>> b/formats/lttng-live/lttng-live-comm.c
>> index 9b409bc..57586a1 100644
>> --- a/formats/lttng-live/lttng-live-comm.c
>> +++ b/formats/lttng-live/lttng-live-comm.c
>> @@ -600,6 +600,11 @@ int append_metadata(struct lttng_live_ctx *ctx,
>> struct lttng_live_viewer_stream *metadata;
>> char *metadata_buf = NULL;
>> + if (!viewer_stream->ctf_trace->handle) {
> If the ctf_trace can be unallocated, shouldn't we check for:
> if (!viewer_stream->ctf_trace) ?
> Jérémie
>> + printf_verbose("append_metadata: trace handle not ready yet.\n");
>> + return 0;
>> + }
>> +
>> printf_verbose("get_next_index: new metadata needed\n");
>> ret = get_new_metadata(ctx, viewer_stream, &metadata_buf);
>> if (ret < 0) {
>> --
>> 2.1.4
> --
> Jérémie Galarneau
> EfficiOS Inc.
> http://www.efficios.com
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20150818/cf907fe5/attachment.html>
More information about the lttng-dev
mailing list