Fix ownership in *_vec_new functions in the C API
These functions are specified to take ownership of the objects in the given slice, not clone them.
This commit is contained in:
@@ -120,8 +120,8 @@ macro_rules! declare_vecs {
|
||||
size: usize,
|
||||
ptr: *const $elem_ty,
|
||||
) {
|
||||
let slice = slice::from_raw_parts(ptr, size);
|
||||
out.set_buffer(slice.to_vec());
|
||||
let vec = (0..size).map(|i| ptr.add(i).read()).collect();
|
||||
out.set_buffer(vec);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
Reference in New Issue
Block a user