From: Jaroslav Kysela Date: Fri, 19 Feb 2016 13:16:49 +0000 (+0100) Subject: timeshift: fix possible pipe overflow (and deadlock) on exit X-Git-Tag: v4.2.1~1009 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb4c72d3afd7394507ebbb76c4f4da7fb90a580b;p=thirdparty%2Ftvheadend.git timeshift: fix possible pipe overflow (and deadlock) on exit --- diff --git a/src/timeshift.c b/src/timeshift.c index 0cce6bc4f..e85a52002 100644 --- a/src/timeshift.c +++ b/src/timeshift.c @@ -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 */