mirror of
https://github.com/libp2p/go-openssl.git
synced 2024-12-26 23:40:07 +08:00
ecfa88cc5b
Use github.com/mattn/go-pointer to save/restore "pointers" across FFI bounderies. Go reserves the right to move pointers, so using `unsafe.Pointer` for this is not safe.
20 lines
296 B
Go
20 lines
296 B
Go
package openssl
|
|
|
|
// #include "shim.h"
|
|
import "C"
|
|
|
|
import (
|
|
"unsafe"
|
|
|
|
"github.com/mattn/go-pointer"
|
|
)
|
|
|
|
//export go_ssl_crypto_ex_free
|
|
func go_ssl_crypto_ex_free(
|
|
parent *C.void, ptr unsafe.Pointer,
|
|
cryptoData *C.CRYPTO_EX_DATA, idx C.int,
|
|
argl C.long, argp *C.void,
|
|
) {
|
|
pointer.Unref(ptr)
|
|
}
|