fix(napi): memory leak with CString
This commit is contained in:
parent
68017ce246
commit
e4f005c735
2 changed files with 2 additions and 2 deletions
|
@ -349,7 +349,7 @@ impl Env {
|
|||
check_status(unsafe {
|
||||
sys::napi_create_function(
|
||||
self.0,
|
||||
name.into_raw(),
|
||||
name.as_ptr(),
|
||||
len,
|
||||
Some(callback),
|
||||
ptr::null_mut(),
|
||||
|
|
|
@ -269,7 +269,7 @@ macro_rules! impl_object_methods {
|
|||
let key = CString::new(name)?;
|
||||
let mut raw_value = ptr::null_mut();
|
||||
check_status(unsafe {
|
||||
sys::napi_get_named_property(self.0.env, self.0.value, key.into_raw(), &mut raw_value)
|
||||
sys::napi_get_named_property(self.0.env, self.0.value, key.as_ptr(), &mut raw_value)
|
||||
})?;
|
||||
T::from_raw(self.0.env, raw_value)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue