mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
Fix memory leak in runtime interface (#4837)
* Fix memory leak in runtime interface We used `slice::from_raw_parts` in runtime-interface which did not free the memory afterwards. This pr changes it to `Vec::from_raw_parts` to make sure `drop` is called properly and the values are freed. * Check that `len` is non-zero * Adds comment
This commit is contained in:
@@ -113,3 +113,18 @@ fn test_overwrite_native_function_implementation() {
|
||||
fn test_u128_i128_as_parameter_and_return_value() {
|
||||
call_wasm_method::<HostFunctions>("test_u128_i128_as_parameter_and_return_value");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_vec_return_value_memory_is_freed() {
|
||||
call_wasm_method::<HostFunctions>("test_vec_return_value_memory_is_freed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_encoded_return_value_memory_is_freed() {
|
||||
call_wasm_method::<HostFunctions>("test_encoded_return_value_memory_is_freed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_array_return_value_memory_is_freed() {
|
||||
call_wasm_method::<HostFunctions>("test_array_return_value_memory_is_freed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user