]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
htsp: Add missing lock when flushing HTSP output queue
authorAndreas Öman <andreas@lonelycoder.com>
Sun, 3 Jun 2012 08:55:31 +0000 (10:55 +0200)
committerAndreas Öman <andreas@lonelycoder.com>
Sun, 3 Jun 2012 08:56:03 +0000 (10:56 +0200)
Fixes #996

src/htsp.c

index 1a630fa7e9a39bff67dafb27aef7f14f16ee0124..af897f07c3e133b13ad276a71a3b11cdc683389c 100644 (file)
@@ -217,6 +217,8 @@ htsp_flush_queue(htsp_connection_t *htsp, htsp_msg_q_t *hmq)
 {
   htsp_msg_t *hm;
 
+  pthread_mutex_lock(&htsp->htsp_out_mutex);
+
   if(hmq->hmq_length)
     TAILQ_REMOVE(&htsp->htsp_active_output_queues, hmq, hmq_link);
 
@@ -224,6 +226,7 @@ htsp_flush_queue(htsp_connection_t *htsp, htsp_msg_q_t *hmq)
     TAILQ_REMOVE(&hmq->hmq_q, hm, hm_link);
     htsp_msg_destroy(hm);
   }
+  pthread_mutex_unlock(&htsp->htsp_out_mutex);
 }