Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts: tables - add mutex protection to mpegts_table_add()
  • Loading branch information
perexg committed Jul 11, 2014
1 parent 528a1db commit efdfaf1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/input/mpegts/mpegts_table.c
Expand Up @@ -136,6 +136,7 @@ mpegts_table_add
int subscribe = 1;

/* Check for existing */
pthread_mutex_lock(&mm->mm_tables_lock);
LIST_FOREACH(mt, &mm->mm_tables, mt_link) {
if (mt->mt_opaque != opaque)
continue;
Expand All @@ -154,11 +155,16 @@ mpegts_table_add
} else {
if (strcmp(mt->mt_name, name))
continue;
if (!(flags & MT_SKIPSUBS) && !mt->mt_subscribed)
if (!(flags & MT_SKIPSUBS) && !mt->mt_subscribed) {
pthread_mutex_unlock(&mm->mm_tables_lock);
mm->mm_open_table(mm, mt, 1);
return mt;
}
}
pthread_mutex_unlock(&mm->mm_tables_lock);
return mt;
}
pthread_mutex_unlock(&mm->mm_tables_lock);

tvhtrace("mpegts", "add %s table %02X/%02X (%d) pid %04X (%d)",
name, tableid, mask, tableid, pid, pid);
Expand Down

0 comments on commit efdfaf1

Please sign in to comment.