summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaulo Roberto Urio <paulourio@gmail.com>2012-06-04 08:40:28 +0800
committerAndy Green <andy.green@linaro.org>2012-06-04 08:40:28 +0800
commit1f680abb7da6994ed7073d52fca2dadc103e5fe4 (patch)
treef8428c55da519cf72236e25b12061985d0528d94 /lib
parentd1db83c6508e2a856156e2500def5392a9a6d788 (diff)
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/libwebsockets.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 4b5ec8b..4c19a15 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++;
}