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

Fixed segfault in libwebsocket_context_destroy.

When creating a context with NULL extensions list,
a segmentation fault was yelled when trying to
destroy the context.  This checks if the
extension list is NULL before go through the list.
Signed-off-by: Paulo Roberto Urio <paulourio@gmail.com>
This commit is contained in:
Paulo Roberto Urio 2012-06-04 08:40:28 +08:00 committed by Andy Green
parent d1db83c650
commit 1f680abb7d

View file

@ -2094,7 +2094,7 @@ libwebsocket_context_destroy(struct libwebsocket_context *context)
m = LWS_EXT_CALLBACK_CLIENT_CONTEXT_DESTRUCT;
if (context->listen_port)
m = LWS_EXT_CALLBACK_SERVER_CONTEXT_DESTRUCT;
while (ext->callback) {
while (ext && ext->callback) {
ext->callback(context, ext, NULL, m, NULL, NULL, 0);
ext++;
}