X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Ffs-src%2Fdata-stream-file.c;h=5f811214f917634a980854e1dd2cf3fe1f14adbc;hp=924a2be788c5fe9b450862d82118005537ecdd2b;hb=f35a48bc5c6a73d05cc441bc34d4371e27265679;hpb=3b16a19b790b255ac0ca7561279b258589b58cbe diff --git a/src/plugins/ctf/fs-src/data-stream-file.c b/src/plugins/ctf/fs-src/data-stream-file.c index 924a2be7..5f811214 100644 --- a/src/plugins/ctf/fs-src/data-stream-file.c +++ b/src/plugins/ctf/fs-src/data-stream-file.c @@ -448,8 +448,11 @@ struct ctf_fs_ds_index *build_index_from_idx_file( total_packets_size += packet_size; file_pos += file_index_entry_size; - g_ptr_array_add(index->entries, index_entry); prev_index_entry = index_entry; + + /* Give ownership of `index_entry` to `index->entries`. */ + g_ptr_array_add(index->entries, index_entry); + index_entry = NULL; } /* Validate that the index addresses the complete stream. */ @@ -547,7 +550,7 @@ struct ctf_fs_ds_index *build_index_from_stream_file( goto error; } - do { + while (true) { off_t current_packet_size_bytes; struct ctf_fs_ds_index_entry *index_entry; struct bt_msg_iter_packet_properties props; @@ -617,11 +620,6 @@ struct ctf_fs_ds_index *build_index_from_stream_file( "next-packet-offset=%jd", (intmax_t) (current_packet_offset_bytes - current_packet_size_bytes), (intmax_t) current_packet_offset_bytes); - - } while (iter_status == BT_MSG_ITER_STATUS_OK); - - if (iter_status != BT_MSG_ITER_STATUS_OK) { - goto error; } end: