From 36af656f2e4fc1d61dd4ab03857ac7ddea6ec7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20T=C3=B6rnblom?= Date: Sat, 10 Mar 2012 12:14:26 +0100 Subject: [PATCH] Fixed crash when subscribing to a channel or service would fail --- src/webui/webui.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/webui/webui.c b/src/webui/webui.c index 2483c2be..71122d00 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -376,11 +376,12 @@ http_stream_service(http_connection_t *hc, service_t *service) pthread_mutex_unlock(&global_lock); - http_stream_run(hc, &sq, s); - - pthread_mutex_lock(&global_lock); - subscription_unsubscribe(s); - pthread_mutex_unlock(&global_lock); + if(s) { + http_stream_run(hc, &sq, s); + pthread_mutex_lock(&global_lock); + subscription_unsubscribe(s); + pthread_mutex_unlock(&global_lock); + } globalheaders_destroy(gh); tsfix_destroy(tsfix); @@ -411,11 +412,12 @@ http_stream_channel(http_connection_t *hc, channel_t *ch) 0); pthread_mutex_unlock(&global_lock); - http_stream_run(hc, &sq, s); - - pthread_mutex_lock(&global_lock); - subscription_unsubscribe(s); - pthread_mutex_unlock(&global_lock); + if(s) { + http_stream_run(hc, &sq, s); + pthread_mutex_lock(&global_lock); + subscription_unsubscribe(s); + pthread_mutex_unlock(&global_lock); + } globalheaders_destroy(gh); tsfix_destroy(tsfix);