1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Fix a possible memory leak in libwebsocket_context_destroy() when compiled without extension support.

Even without extension support :
  All wsi sessions stored into lws_lookup[] SHOULD BE closed_and_freed.
  The callback(reason=_PROTOCOL_DESTROY) SHOULD BE called.
This commit is contained in:
arnaudviala 2014-02-07 17:03:21 +01:00
parent eca0e4913d
commit ed1cdbbd54

View file

@ -1209,10 +1209,11 @@ handled:
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 @@ libwebsocket_context_destroy(struct libwebsocket_context *context)
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 @@ libwebsocket_context_destroy(struct libwebsocket_context *context)
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 @@ libwebsocket_context_destroy(struct libwebsocket_context *context)
protocol++;
}
#endif
#if defined(WIN32) || defined(_WIN32)
#else