From 2e083832acde0507be3c3465907287ca31cc67bb Mon Sep 17 00:00:00 2001 From: "Kevin R. Thornton" Date: Mon, 18 Jul 2022 16:10:17 -0700 Subject: [PATCH] fix: fix leak in TreeSequence::dump_tables --- src/table_collection.rs | 2 +- src/trees.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/table_collection.rs b/src/table_collection.rs index 68845fba3..3be6940e2 100644 --- a/src/table_collection.rs +++ b/src/table_collection.rs @@ -108,7 +108,7 @@ impl TableCollection { Ok(tables) } - fn new_uninit() -> Self { + pub(crate) fn new_uninit() -> Self { Self::wrap() } diff --git a/src/trees.rs b/src/trees.rs index 585b69a02..2167c6ea4 100644 --- a/src/trees.rs +++ b/src/trees.rs @@ -1062,7 +1062,7 @@ impl TreeSequence { /// /// [`TskitError`] will be raised if the underlying C library returns an error code. pub fn dump_tables(&self) -> Result { - let mut copy = TableCollection::new(1.)?; + let mut copy = TableCollection::new_uninit(); let rv = unsafe { ll_bindings::tsk_table_collection_copy((*self.as_ptr()).tables, copy.as_mut_ptr(), 0)