aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-05-21 19:22:00 +0200
committerPaul B Mahol <onemda@gmail.com>2016-05-21 19:23:04 +0200
commitdefb960a47f6d8f801168e1c61399f6abfb79ef3 (patch)
treea5699035fa0ca3f4946846ea0c801698c06c39f5
parent4da4bfcdc9008e1794cbc627c7acfde06ee48237 (diff)
downloadffmpeg-defb960a47f6d8f801168e1c61399f6abfb79ef3.tar.gz
avfilter/af_loudnorm: fix crash when ebur128 initialization was not successfull/complete
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavfilter/af_loudnorm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c
index cb210d41fe..9d27c16b98 100644
--- a/libavfilter/af_loudnorm.c
+++ b/libavfilter/af_loudnorm.c
@@ -789,6 +789,9 @@ static av_cold void uninit(AVFilterContext *ctx)
double i_in, i_out, lra_in, lra_out, thresh_in, thresh_out, tp_in, tp_out;
int c;
+ if (!s->r128_in || !s->r128_out)
+ goto end;
+
ebur128_loudness_range(s->r128_in, &lra_in);
ebur128_loudness_global(s->r128_in, &i_in);
ebur128_relative_threshold(s->r128_in, &thresh_in);
@@ -869,8 +872,11 @@ static av_cold void uninit(AVFilterContext *ctx)
break;
}
- ebur128_destroy(&s->r128_in);
- ebur128_destroy(&s->r128_out);
+end:
+ if (s->r128_in)
+ ebur128_destroy(&s->r128_in);
+ if (s->r128_out)
+ ebur128_destroy(&s->r128_out);
av_freep(&s->limiter_buf);
av_freep(&s->prev_smp);
av_freep(&s->buf);