From be3749f45cc262b46c409a7d6b37e5681ef8160b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 11 Mar 2015 16:27:07 +0100 Subject: [PATCH] subscriptions: manage ths_mux_link early to avoid wrong memory accesses --- src/subscriptions.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/subscriptions.c b/src/subscriptions.c index 233d2da6..0bd10acb 100644 --- a/src/subscriptions.c +++ b/src/subscriptions.c @@ -514,6 +514,11 @@ subscription_unsubscribe(th_subscription_t *s, int quiet) LIST_REMOVE(s, ths_global_link); +#if ENABLE_MPEGTS + if (s->ths_raw_service) + LIST_REMOVE(s, ths_mux_link); +#endif + if (s->ths_channel != NULL) { LIST_REMOVE(s, ths_channel_link); snprintf(buf, sizeof(buf), "\"%s\" unsubscribing from \"%s\"", @@ -537,10 +542,8 @@ subscription_unsubscribe(th_subscription_t *s, int quiet) } #if ENABLE_MPEGTS - if (s->ths_raw_service) { - LIST_REMOVE(s, ths_mux_link); + if (s->ths_raw_service) service_destroy(s->ths_raw_service, 0); - } #endif streaming_msg_free(s->ths_start_message);