mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
fix(napi): memory leak with CString
This commit is contained in:
parent
68017ce246
commit
e4f005c735
@ -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…
x
Reference in New Issue
Block a user