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 {
108
108
Ok ( tables)
109
109
}
110
110
111
+ fn new_uninit ( ) -> Self {
112
+ Self :: wrap ( )
113
+ }
114
+
111
115
pub ( crate ) fn into_raw ( self ) -> Result < * mut ll_bindings:: tsk_table_collection_t , TskitError > {
112
116
let mut tables = self ;
113
117
// rust won't let use move inner out b/c this type implements Drop.
@@ -1003,7 +1007,9 @@ impl TableCollection {
1003
1007
1004
1008
/// Return a "deep" copy of the tables.
1005
1009
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 ( ) ;
1007
1013
1008
1014
let rv =
1009
1015
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