Fixes memory issue
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-07-18 10:49:58 +02:00
parent 7682704945
commit 9472c1cec2
6 changed files with 19 additions and 16 deletions

View File

@@ -1,9 +1,7 @@
use core::ffi::c_char;
use std::borrow::Cow;
use std::ffi::CString;
use std::mem::{align_of, size_of};
use std::mem::align_of;
use wasmer::wasmparser::Data;
use wasmer::{Exports, Function, Store};
use crate::dynamic_data::DynamicLibrary;
@@ -82,7 +80,7 @@ fn const_string_get_hash(env: &WebAssemblyEnv, string_key: ExternRef<StringKey>)
fn const_string_get_str(env: &WebAssemblyEnv, string_key: ExternRef<StringKey>) -> u32 {
let string_key = string_key.value(env).str();
let mut s: CString = CString::new(string_key.as_bytes()).unwrap();
let s: CString = CString::new(string_key.as_bytes()).unwrap();
let wasm_string_ptr = env
.resolver()
.allocate_mem(string_key.len() as u32, align_of::<CString>() as u32);