changeset 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 89270a3bc4a0
children ff0ea87dd64e
files h264.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
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++)