summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2016-05-17 14:59:10 -0600
committerJohn Stebbins <[email protected]>2016-05-17 14:59:10 -0600
commitc67272ae6461159bb18a156a325d7bd6f8dc6df8 (patch)
tree8e53828cc94db2a122f792231a34740ba0abbd1a
parent1d31b9c7210833c2241a712a6b338c4aa9526393 (diff)
sync: fix race condition that caused double free
-rw-r--r--libhb/sync.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libhb/sync.c b/libhb/sync.c
index 69e6d18e4..4e5f7662e 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -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,