]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
timeshift: fix possible pipe overflow (and deadlock) on exit
authorJaroslav Kysela <perex@perex.cz>
Fri, 19 Feb 2016 13:16:49 +0000 (14:16 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 19 Feb 2016 13:16:49 +0000 (14:16 +0100)
src/timeshift.c

index 0cce6bc4fd55af402684d9b58e560b1eece7c7bb..e85a520020049da69e94bcac79e5b417d5dd7cfb 100644 (file)
@@ -298,6 +298,9 @@ static void timeshift_input
   timeshift_t *ts = opaque;
   th_pkt_t *pkt, *pkt2;
 
+  if (ts->exit)
+    return;
+
   /* Control */
   if (type == SMT_SKIP) {
     timeshift_write_skip(ts->rd_pipe.wr, sm->sm_data);
@@ -365,7 +368,8 @@ timeshift_destroy(streaming_target_t *pad)
   pthread_mutex_lock(&ts->state_mutex);
   sm = streaming_msg_create(SMT_EXIT);
   streaming_target_deliver2(&ts->wr_queue.sq_st, sm);
-  timeshift_write_exit(ts->rd_pipe.wr);
+  if (!ts->exit)
+    timeshift_write_exit(ts->rd_pipe.wr);
   pthread_mutex_unlock(&ts->state_mutex);
 
   /* Wait for all threads */