> > ```
> > void ocall_free([user_check]void* p);
> > -----
> > #[no_mangle]
> > pub extern "C" fn ocall_free(p: *mut libc::c_void) {
> > println!("addr: {:?}", p);
> > unsafe { libc::free(p) }
> > }
> > ```
>
> before you call `ocall-free`, what is the pointer's value? is it pointing to
> an unsafe buffer? can i pass the sgx_is_outside_enclave check?
```
....
let mut output = 0 as *mut libc::c_void;
let mut out_len: usize = 0;
let resp = unsafe {
ocall_call(&mut rt,
req.as_ptr() as *const u8,
req.len(),
&mut output,
&mut out_len)
};
// TODO resp和rt都要判断
match resp {
sgx_status_t::SGX_SUCCESS => {
....
println!("before free: {:?}", output);
let mut rt : sgx_status_t = sgx_status_t::SGX_ERROR_UNEXPECTED;
unsafe{ocall_free(&mut rt, output as usize)};
..
Ok(xxxx)
},
...
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/251#issuecomment-647835021