]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
subscriptions: manage ths_mux_link early to avoid wrong memory accesses
authorJaroslav Kysela <perex@perex.cz>
Wed, 11 Mar 2015 15:27:07 +0000 (16:27 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 11 Mar 2015 20:41:13 +0000 (21:41 +0100)
src/subscriptions.c

index 233d2da604eca027a091ae0f6fc692c78d0b54be..0bd10acb7f07fbd305d6694694bc876ac2ca1a05 100644 (file)
@@ -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);