Fix: don't access missing ctf trace when getting metadata
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 14 Aug 2015 18:55:11 +0000 (14:55 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 31 Jan 2018 19:46:03 +0000 (14:46 -0500)
We can get metadata when still in the trace open functions, in which
case the ctf trace is not allocated nor available yet. This fixes a
segmentation fault in stress-test.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/lttng-live/lttng-live-comm.c

index 2b793e5f357ba30079b884a01d9df4a5a08295a7..8059b338b095dd4672021946ae497b3f8a45f7dd 100644 (file)
@@ -607,6 +607,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) {
+               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) {
This page took 0.033303 seconds and 4 git commands to generate.