From 1f680abb7da6994ed7073d52fca2dadc103e5fe4 Mon Sep 17 00:00:00 2001 From: Paulo Roberto Urio Date: Mon, 4 Jun 2012 08:40:28 +0800 Subject: [PATCH] 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 --- lib/libwebsockets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 4b5ec8bf..4c19a152 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -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++; }