OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / libhb / decvobsub.c
index c4474f9..e180b23 100644 (file)
@@ -136,6 +136,10 @@ int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
 
 void decsubClose( hb_work_object_t * w )
 {
+    hb_work_private_t * pv = w->private_data;
+
+    if ( pv->buf )
+        hb_buffer_close( &pv->buf );
     free( w->private_data );
 }
 
@@ -501,6 +505,7 @@ static hb_buffer_t * Decode( hb_work_object_t * w )
          * When forcing subtitles, ignore all those that don't
          * have the forced flag set.
          */
+        hb_buffer_close( &pv->buf );
         return NULL;
     }
 
@@ -508,7 +513,9 @@ static hb_buffer_t * Decode( hb_work_object_t * w )
     {
         pv->buf->start  = pv->pts_start;
         pv->buf->stop   = pv->pts_stop;
-        return pv->buf;
+        buf = pv->buf;
+        pv->buf = NULL;
+        return buf;
     }
 
     /* Do the actual decoding now */