diff h264.c @ 9862:db929fcaeb9a libavcodec

H.264: Fix memory leaks with multithreading. The threads' contexts and rbsp_buffers were not freed at the end of decoding. Fixes issue 1581
author astrange
date Tue, 16 Jun 2009 21:50:36 +0000
parents febe1855b64a
children c4ef915fbefa
line wrap: on
line diff
--- a/h264.c	Tue Jun 16 17:33:57 2009 +0000
+++ b/h264.c	Tue Jun 16 21:50:36 2009 +0000
@@ -1997,6 +1997,9 @@
         av_freep(&hx->top_borders[1]);
         av_freep(&hx->top_borders[0]);
         av_freep(&hx->s.obmc_scratchpad);
+        av_freep(&hx->rbsp_buffer[1]);
+        av_freep(&hx->rbsp_buffer[0]);
+        if (i) av_freep(&h->thread_context[i]);
     }
 }
 
@@ -8123,8 +8126,6 @@
 {
     int i;
 
-    av_freep(&h->rbsp_buffer[0]);
-    av_freep(&h->rbsp_buffer[1]);
     free_tables(h); //FIXME cleanup init stuff perhaps
 
     for(i = 0; i < MAX_SPS_COUNT; i++)