Mercurial > libavcodec.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
9861:89270a3bc4a0 | 9862:db929fcaeb9a |
---|---|
1995 hx = h->thread_context[i]; | 1995 hx = h->thread_context[i]; |
1996 if(!hx) continue; | 1996 if(!hx) continue; |
1997 av_freep(&hx->top_borders[1]); | 1997 av_freep(&hx->top_borders[1]); |
1998 av_freep(&hx->top_borders[0]); | 1998 av_freep(&hx->top_borders[0]); |
1999 av_freep(&hx->s.obmc_scratchpad); | 1999 av_freep(&hx->s.obmc_scratchpad); |
2000 av_freep(&hx->rbsp_buffer[1]); | |
2001 av_freep(&hx->rbsp_buffer[0]); | |
2002 if (i) av_freep(&h->thread_context[i]); | |
2000 } | 2003 } |
2001 } | 2004 } |
2002 | 2005 |
2003 static void init_dequant8_coeff_table(H264Context *h){ | 2006 static void init_dequant8_coeff_table(H264Context *h){ |
2004 int i,q,x; | 2007 int i,q,x; |
8121 | 8124 |
8122 av_cold void ff_h264_free_context(H264Context *h) | 8125 av_cold void ff_h264_free_context(H264Context *h) |
8123 { | 8126 { |
8124 int i; | 8127 int i; |
8125 | 8128 |
8126 av_freep(&h->rbsp_buffer[0]); | |
8127 av_freep(&h->rbsp_buffer[1]); | |
8128 free_tables(h); //FIXME cleanup init stuff perhaps | 8129 free_tables(h); //FIXME cleanup init stuff perhaps |
8129 | 8130 |
8130 for(i = 0; i < MAX_SPS_COUNT; i++) | 8131 for(i = 0; i < MAX_SPS_COUNT; i++) |
8131 av_freep(h->sps_buffers + i); | 8132 av_freep(h->sps_buffers + i); |
8132 | 8133 |