]> granicus.if.org Git - handbrake/commitdiff
sync: fix race condition that caused double free
authorJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 17 May 2016 20:59:10 +0000 (14:59 -0600)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 17 May 2016 20:59:10 +0000 (14:59 -0600)
libhb/sync.c

index 69e6d18e455f28f007ee9aa2704953124c428dd8..4e5f7662e662792b1c54f66b48ab1961d46cdd26 100644 (file)
@@ -684,6 +684,8 @@ static void sendEof( sync_common_t * common )
 
 static void streamFlush( sync_stream_t * stream )
 {
+    hb_lock(stream->common->mutex);
+
     while (hb_list_count(stream->in_queue) > 0)
     {
         if (!stream->common->found_first_pts)
@@ -777,6 +779,8 @@ static void streamFlush( sync_stream_t * stream )
         }
     }
     hb_buffer_list_append(&stream->out_queue, hb_buffer_eof_init());
+
+    hb_unlock(stream->common->mutex);
 }
 
 static void log_chapter( sync_common_t *common, int chap_num,