fix memory leak
Fix a possible memory leak in
libwebsocket_context_destroy() when compiled without extension support.
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 7d34568..2eaaceb 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -1209,10 +1209,11 @@
LWS_VISIBLE void
libwebsocket_context_destroy(struct libwebsocket_context *context)
{
-#ifndef LWS_NO_EXTENSIONS
int n;
+#ifndef LWS_NO_EXTENSIONS
int m;
struct libwebsocket_extension *ext;
+#endif /* ndef LWS_NO_EXTENSIONS */
struct libwebsocket_protocols *protocol = context->protocols;
#ifdef LWS_LATENCY
@@ -1228,6 +1229,7 @@
n--;
}
+#ifndef LWS_NO_EXTENSIONS
/*
* give all extensions a chance to clean up any per-context
* allocations they might have made
@@ -1243,6 +1245,7 @@
NULL, NULL, 0);
ext++;
}
+#endif /* ndef LWS_NO_EXTENSIONS */
/*
* inform all the protocols that they are done and will have no more
@@ -1255,7 +1258,6 @@
protocol++;
}
-#endif
#if defined(WIN32) || defined(_WIN32)
#else
@@ -1812,9 +1814,11 @@
* This is just used to interrupt poll waiting
* we don't have to do anything with it.
*/
+#ifdef LWS_OPENSSL_SUPPORT
static void lws_sigusr2(int sig)
{
}
+#endif
/**
* libwebsocket_create_context() - Create the websocket handler