From: Mathieu Desnoyers Date: Mon, 23 May 2011 14:10:14 +0000 (-0400) Subject: Fix null stream handling X-Git-Tag: v0.1~30 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=e9378815b6be9213062f4097247bade3642ad479 Fix null stream handling Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 730e2a3a..5e43d2fa 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -52,7 +52,9 @@ extern int yydebug; +static struct trace_descriptor *ctf_open_trace(const char *path, int flags); +static void ctf_close_trace(struct trace_descriptor *descriptor); static @@ -907,6 +909,7 @@ error: return ret; } +static struct trace_descriptor *ctf_open_trace(const char *path, int flags) { struct ctf_trace *td; @@ -945,6 +948,7 @@ void ctf_close_file_stream(struct ctf_file_stream *file_stream) close(file_stream->pos.fd); } +static void ctf_close_trace(struct trace_descriptor *tdp) { struct ctf_trace *td = container_of(tdp, struct ctf_trace, parent); @@ -954,7 +958,10 @@ void ctf_close_trace(struct trace_descriptor *tdp) for (i = 0; i < td->streams->len; i++) { struct ctf_stream_class *stream; int j; + stream = g_ptr_array_index(td->streams, i); + if (!stream) + continue; for (j = 0; j < stream->files->len; j++) { struct ctf_file_stream *file_stream; file_stream = g_ptr_array_index(stream->files, j);