Fix: ctf: uninitialized packet_index, misuse of index
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 10 Feb 2014 21:23:24 +0000 (16:23 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 10 Feb 2014 21:23:24 +0000 (16:23 -0500)
Issues introduced by
commit f1f52630ef26bb227cf1e8fedcff9b938d7a2f1e

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/ctf.c

index 515bbe1a2c256aea19efefc3c1af9bfe35ac82d9..141f9bfae0c7c7dd040471d74c725fc97a622bc0 100644 (file)
@@ -887,9 +887,12 @@ void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence)
                                return;
                        }
                        assert(pos->cur_index < pos->packet_index->len);
-                       if (index > 0) {
+                       packet_index = &g_array_index(pos->packet_index,
+                                       struct packet_index, pos->cur_index);
+                       if (pos->cur_index > 0) {
                                prev_index = &g_array_index(pos->packet_index,
-                                               struct packet_index, index - 1);
+                                               struct packet_index,
+                                               pos->cur_index - 1);
                        }
                        ctf_update_current_packet_index(&file_stream->parent,
                                        prev_index, packet_index);
This page took 0.026449 seconds and 4 git commands to generate.