]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
subscription: for stupid mistake causing double free()'s
authorAdam Sutton <dev@adamsutton.me.uk>
Tue, 10 Sep 2013 20:15:02 +0000 (21:15 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Tue, 10 Sep 2013 20:15:02 +0000 (21:15 +0100)
src/input/mpegts/mpegts_mux.c
src/subscriptions.c
src/subscriptions.h

index a0edd5d76169efd3c4b07046c401532fa72d5caa..ab52083ee4fd358f1e1ab01437a4d676f64fe2d3 100644 (file)
@@ -656,7 +656,7 @@ mpegts_mux_unsubscribe_by_name
 
   LIST_FOREACH(mmi, &mm->mm_instances, mmi_mux_link)
     LIST_FOREACH(s, &mmi->mmi_subs, ths_mmi_link)
-      if (!strcmp(s->ths_title, "initscan"))
+      if (!strcmp(s->ths_title, name))
         subscription_unsubscribe(s);
 }
 
index ad66da9d120ce4d0b0c851d308bbe07cdb056fde..1b34f1553fd862091bcfb77c7e64047cad7d8cd3 100644 (file)
@@ -252,8 +252,8 @@ subscription_reschedule(void)
 static void
 subscription_input_null(void *opaque, streaming_message_t *sm)
 {
-  if (sm->sm_type == SMT_STOP) {
-    th_subscription_t *s = opaque;
+  th_subscription_t *s = opaque;
+  if (sm->sm_type == SMT_STOP && s->ths_state != SUBSCRIPTION_ZOMBIE) {
     LIST_INSERT_HEAD(&subscriptions_remove, s, ths_remove_link);
     gtimer_arm(&subscription_reschedule_timer, 
               subscription_reschedule_cb, NULL, 0);
@@ -348,6 +348,8 @@ subscription_unsubscribe(th_subscription_t *s)
 
   lock_assert(&global_lock);
 
+  s->ths_state = SUBSCRIPTION_ZOMBIE;
+
   service_instance_list_clear(&s->ths_instances);
 
   LIST_REMOVE(s, ths_global_link);
index 7095897e385a9d632c2d5f2bb1ed66b40701cf70..5287c6f2c1d29ef6c51f2290440422c446d23a9b 100644 (file)
@@ -39,6 +39,7 @@ typedef struct th_subscription {
     SUBSCRIPTION_TESTING_SERVICE,
     SUBSCRIPTION_GOT_SERVICE,
     SUBSCRIPTION_BAD_SERVICE,
+    SUBSCRIPTION_ZOMBIE
   } ths_state;
 
   int ths_testing_error;