File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,10 @@ impl TableCollection {
108108 Ok ( tables)
109109 }
110110
111+ fn new_uninit ( ) -> Self {
112+ Self :: wrap ( )
113+ }
114+
111115 pub ( crate ) fn into_raw ( self ) -> Result < * mut ll_bindings:: tsk_table_collection_t , TskitError > {
112116 let mut tables = self ;
113117 // rust won't let use move inner out b/c this type implements Drop.
@@ -1003,7 +1007,9 @@ impl TableCollection {
10031007
10041008 /// Return a "deep" copy of the tables.
10051009 pub fn deepcopy ( & self ) -> Result < TableCollection , TskitError > {
1006- let mut copy = TableCollection :: new ( 1. ) ?;
1010+ // The output is UNINITIALIZED tables,
1011+ // else we leak memory
1012+ let mut copy = Self :: new_uninit ( ) ;
10071013
10081014 let rv =
10091015 unsafe { ll_bindings:: tsk_table_collection_copy ( self . as_ptr ( ) , copy. as_mut_ptr ( ) , 0 ) } ;
You can’t perform that action at this time.
0 commit comments