diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d28d331db..68593717f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,7 +9,8 @@ jobs:
     steps:
     - uses: actions/checkout@v2
     - name: make
-      run: make
+      # build with TLS just for compilatoin coverage
+      run: make BUILD_TLS=yes
     - name: test
       run: |
         sudo apt-get install tcl8.5
diff --git a/src/tls.c b/src/tls.c
index f55d25c78..d3173fab0 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -454,7 +454,7 @@ void updateSSLEvent(tls_connection *conn) {
 }
 
 static void tlsHandleEvent(tls_connection *conn, int mask) {
-    int ret;
+    int ret, conn_error;
 
     TLSCONN_DEBUG("tlsEventHandler(): fd=%d, state=%d, mask=%d, r=%d, w=%d, flags=%d",
             fd, conn->c.state, mask, conn->c.read_handler != NULL, conn->c.write_handler != NULL,
@@ -464,7 +464,7 @@ static void tlsHandleEvent(tls_connection *conn, int mask) {
 
     switch (conn->c.state) {
         case CONN_STATE_CONNECTING:
-            int conn_error = connGetSocketError((connection *) conn);
+            conn_error = connGetSocketError((connection *) conn);
             if (conn_error) {
                 conn->c.last_errno = conn_error;
                 conn->c.state = CONN_STATE_ERROR;