subscription: for stupid mistake causing double free()'s

This commit is contained in:
Adam Sutton 2013-09-10 21:15:02 +01:00
parent 64655df096
commit 4fb7dca71e
3 changed files with 6 additions and 3 deletions

View 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);
}

View 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);

View 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;