From: Paulo Roberto Urio Date: Mon, 4 Jun 2012 00:40:28 +0000 (+0800) Subject: Fixed segfault in libwebsocket_context_destroy. X-Git-Tag: 1.2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f680abb7da6994ed7073d52fca2dadc103e5fe4;p=profile%2Fivi%2Flibwebsockets.git 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 --- 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++; }