summaryrefslogtreecommitdiff
path: root/regress/lib
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2017-03-07 12:29:32 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2017-03-07 12:29:32 +0000
commitc2a89444248bbc3ea42086b3b713fba8832a1f57 (patch)
tree3736d762cab169638e68308f92670c4bb0aee76b /regress/lib
parente32497c54e68a5aa75377f0cc7f8bae8a84066d3 (diff)
We no longer need to keep pointers following tls_config_set_*() calls.
Diffstat (limited to 'regress/lib')
-rw-r--r--regress/lib/libtls/gotls/tls.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/regress/lib/libtls/gotls/tls.go b/regress/lib/libtls/gotls/tls.go
index 74c34b4064c..88d58ab33ba 100644
--- a/regress/lib/libtls/gotls/tls.go
+++ b/regress/lib/libtls/gotls/tls.go
@@ -26,7 +26,6 @@ var (
// TLSConfig provides configuration options for a TLS context.
type TLSConfig struct {
- caFile *C.char
tlsCfg *C.struct_tls_config
}
@@ -57,11 +56,9 @@ func NewConfig() (*TLSConfig, error) {
// SetCAFile sets the CA file to be used for connections.
func (c *TLSConfig) SetCAFile(filename string) {
- if c.caFile != nil {
- C.free(unsafe.Pointer(c.caFile))
- }
- c.caFile = C.CString(filename)
- C.tls_config_set_ca_file(c.tlsCfg, c.caFile)
+ caFile := C.CString(filename)
+ defer C.free(unsafe.Pointer(caFile))
+ C.tls_config_set_ca_file(c.tlsCfg, caFile)
}
// InsecureNoVerifyCert disables certificate verification for the connection.