Always evaluate BT_ASSERT(); add BT_ASSERT_DBG() for debug mode only
[babeltrace.git] / src / plugins / ctf / fs-src / data-stream-file.c
index 4f2c8375f5b32efe1e15eb0474ccd302f80cfced..c0a8754e9b7cb33c879e61c2aad74af541928585 100644 (file)
@@ -48,7 +48,7 @@
 static inline
 size_t remaining_mmap_bytes(struct ctf_fs_ds_file *ds_file)
 {
-       BT_ASSERT(ds_file->mmap_len >= ds_file->request_offset);
+       BT_ASSERT_DBG(ds_file->mmap_len >= ds_file->request_offset);
        return ds_file->mmap_len - ds_file->request_offset;
 }
 
@@ -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. */
This page took 0.024916 seconds and 4 git commands to generate.