$OpenBSD: patch-src_core_tcp_read_c,v 1.3 2018/03/20 22:03:35 sthen Exp $

Index: src/core/tcp_read.c
--- src/core/tcp_read.c.orig
+++ src/core/tcp_read.c
@@ -1530,6 +1530,14 @@ void release_tcpconn(struct tcp_connection* c, long st
 				ip_addr2a(&c->rcv.src_ip), c->rcv.src_port,
 				ip_addr2a(&c->rcv.dst_ip), c->rcv.dst_port);
 		LM_DBG("extra_data %p\n", c->extra_data);
+
+		/* experimental fix tls crash with libressl */
+		/* add cleanup SSL structure in child process, in parent process SSL structure is empty */
+		if ((c->type==PROTO_TLS || c->type==PROTO_WSS) && (c->extra_data) && c->fd != -1) {
+			tls_close(c, c->fd);
+			tls_tcpconn_clean(c);
+		}
+
 		/* release req & signal the parent */
 		c->reader_pid=0; /* reset it */
 		if (c->fd!=-1){
