Skip to content

Commit 60cd225

Browse files
authored
fix: fix leak in TreeSequence::dump_tables (#276)
1 parent 3feb5ba commit 60cd225

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/table_collection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl TableCollection {
108108
Ok(tables)
109109
}
110110

111-
fn new_uninit() -> Self {
111+
pub(crate) fn new_uninit() -> Self {
112112
Self::wrap()
113113
}
114114

src/trees.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ impl TreeSequence {
10621062
///
10631063
/// [`TskitError`] will be raised if the underlying C library returns an error code.
10641064
pub fn dump_tables(&self) -> Result<TableCollection, TskitError> {
1065-
let mut copy = TableCollection::new(1.)?;
1065+
let mut copy = TableCollection::new_uninit();
10661066

10671067
let rv = unsafe {
10681068
ll_bindings::tsk_table_collection_copy((*self.as_ptr()).tables, copy.as_mut_ptr(), 0)

0 commit comments

Comments
 (0)