From 750d871269cef0724c68db7f3f8105a7bf5f99c8 Mon Sep 17 00:00:00 2001
From: jstebbins <jstebbins.hb@gmail.com>
Date: Thu, 10 Nov 2011 23:29:23 +0000
Subject: Fix closed captioning crash

Prevent the same CC buffer from being attached to multiple tags.  The
same buffer would get pushed to a fifo multiple times and ultimately
freed multiple times.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4345 b64f7644-9d1e-0410-96f1-a4d463321fa5
---
 libhb/decmpeg2.c | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'libhb/decmpeg2.c')

diff --git a/libhb/decmpeg2.c b/libhb/decmpeg2.c
index 3c84fea50..f37ee9022 100644
--- a/libhb/decmpeg2.c
+++ b/libhb/decmpeg2.c
@@ -242,6 +242,9 @@ static void extract_mpeg2_captions( hb_libmpeg2_t *m )
 
 static void next_tag( hb_libmpeg2_t *m, hb_buffer_t *buf_es )
 {
+    if( m->tags[m->cur_tag].cc_buf == m->last_cc1_buf )
+        m->last_cc1_buf = NULL;
+
     m->cur_tag = ( m->cur_tag + 1 ) & (NTAGS-1);
     if ( m->tags[m->cur_tag].start >= 0 || m->tags[m->cur_tag].cc_buf )
     {
-- 
cgit v1.2.3