diff options
-rw-r--r-- | src/regress/lib/libtls/gotls/tls.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/regress/lib/libtls/gotls/tls.go b/src/regress/lib/libtls/gotls/tls.go index 74c34b4064..88d58ab33b 100644 --- a/src/regress/lib/libtls/gotls/tls.go +++ b/src/regress/lib/libtls/gotls/tls.go | |||
@@ -26,7 +26,6 @@ var ( | |||
26 | 26 | ||
27 | // TLSConfig provides configuration options for a TLS context. | 27 | // TLSConfig provides configuration options for a TLS context. |
28 | type TLSConfig struct { | 28 | type TLSConfig struct { |
29 | caFile *C.char | ||
30 | tlsCfg *C.struct_tls_config | 29 | tlsCfg *C.struct_tls_config |
31 | } | 30 | } |
32 | 31 | ||
@@ -57,11 +56,9 @@ func NewConfig() (*TLSConfig, error) { | |||
57 | 56 | ||
58 | // SetCAFile sets the CA file to be used for connections. | 57 | // SetCAFile sets the CA file to be used for connections. |
59 | func (c *TLSConfig) SetCAFile(filename string) { | 58 | func (c *TLSConfig) SetCAFile(filename string) { |
60 | if c.caFile != nil { | 59 | caFile := C.CString(filename) |
61 | C.free(unsafe.Pointer(c.caFile)) | 60 | defer C.free(unsafe.Pointer(caFile)) |
62 | } | 61 | C.tls_config_set_ca_file(c.tlsCfg, caFile) |
63 | c.caFile = C.CString(filename) | ||
64 | C.tls_config_set_ca_file(c.tlsCfg, c.caFile) | ||
65 | } | 62 | } |
66 | 63 | ||
67 | // InsecureNoVerifyCert disables certificate verification for the connection. | 64 | // InsecureNoVerifyCert disables certificate verification for the connection. |