Pārlūkot izejas kodu

Fix constant variable guarding dead code reported by Coverity.

Kimmo Mustonen 8 gadi atpakaļ
vecāks
revīzija
cdad93b229
1 mainītis faili ar 9 papildinājumiem un 3 dzēšanām
  1. 9 3
      src/civetweb.c

+ 9 - 3
src/civetweb.c

@@ -13599,7 +13599,9 @@ close_connection(struct mg_connection *conn)
 void
 mg_close_connection(struct mg_connection *conn)
 {
+#if defined(USE_WEBSOCKET)
 	struct mg_context *client_ctx = NULL;
+#endif /* defined(USE_WEBSOCKET) */
 
 	if (conn == NULL) {
 		return;
@@ -13626,9 +13628,7 @@ mg_close_connection(struct mg_connection *conn)
 			}
 		}
 	}
-#else
-	(void)client_ctx;
-#endif
+#endif /* defined(USE_WEBSOCKET) */
 
 	close_connection(conn);
 
@@ -13638,6 +13638,7 @@ mg_close_connection(struct mg_connection *conn)
 	}
 #endif
 
+#if defined(USE_WEBSOCKET)
 	if (client_ctx != NULL) {
 		/* free context */
 		mg_free(client_ctx->worker_threadids);
@@ -13647,6 +13648,11 @@ mg_close_connection(struct mg_connection *conn)
 	} else if (conn->ctx->context_type == 0) { /* Client */
 		mg_free(conn);
 	}
+#else
+	if (conn->ctx->context_type == 0) { /* Client */
+		mg_free(conn);
+	}
+#endif /* defined(USE_WEBSOCKET) */
 }