go-openssl/alloc.go
Steven Allen ecfa88cc5b fix: unsafe pointer passing
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.
2021-08-27 10:46:42 -07:00

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)
}