aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2015-02-05 19:51:22 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-05 21:50:35 +0100
commit9a2f5d825a257cc72d569a91746219c7974da6e4 (patch)
treef6da5010bee79e2edca71ad5edb8dd0981c4393c
parenta83b6b077c56341300a271ef4a1aaff19af5235d (diff)
downloadffmpeg-9a2f5d825a257cc72d569a91746219c7974da6e4.tar.gz
hevc: free sao buffers when receiving a new SPS
The buffer pointers would be otherwise overwritten, causing a leak on e.g. PERSIST_RPARAM_A_RExt_Sony_1. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/hevc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 0624cb0c72..afbfda1816 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -284,7 +284,7 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
{
#define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL)
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;
- int ret;
+ int ret, i;
unsigned int num = 0, den = 0;
pic_arrays_free(s);
@@ -334,6 +334,13 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
ff_hevc_dsp_init (&s->hevcdsp, sps->bit_depth);
ff_videodsp_init (&s->vdsp, sps->bit_depth);
+ for (i = 0; i < 3; i++) {
+ if (s->sao_pixel_buffer_h[i])
+ av_freep(&s->sao_pixel_buffer_h[i]);
+ if (s->sao_pixel_buffer_v[i])
+ av_freep(&s->sao_pixel_buffer_v[i]);
+ }
+
if (sps->sao_enabled && !s->avctx->hwaccel) {
int c_count = (sps->chroma_format_idc != 0) ? 3 : 1;
int c_idx;