summaryrefslogtreecommitdiff
path: root/libavfilter/avf_showvolume.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-04-13 18:18:49 +0200
committerPaul B Mahol <onemda@gmail.com>2022-04-13 18:24:25 +0200
commit24144af2dd75c426d6d291f81e8e9206969b805b (patch)
treec4547fb095a7ab8b7d76eb0513b088d1c0467c9d /libavfilter/avf_showvolume.c
parentfa3f9f2f6acc48fe6ac6af1ea723066d6851743c (diff)
avfilter/avf_showvolume: check for allocation error and stop leaks
Diffstat (limited to 'libavfilter/avf_showvolume.c')
-rw-r--r--libavfilter/avf_showvolume.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c
index 1c072a16a6..eb79a5ebdb 100644
--- a/libavfilter/avf_showvolume.c
+++ b/libavfilter/avf_showvolume.c
@@ -190,6 +190,9 @@ static int config_input(AVFilterLink *inlink)
s->persistent_max_frames = (int) FFMAX(av_q2d(s->frame_rate) * s->draw_persistent_duration, 1.);
s->max_persistent = av_calloc(inlink->ch_layout.nb_channels * s->persistent_max_frames, sizeof(*s->max_persistent));
s->nb_frames_max_display = av_calloc(inlink->ch_layout.nb_channels * s->persistent_max_frames, sizeof(*s->nb_frames_max_display));
+ if (!s->max_persistent ||
+ !s->nb_frames_max_display)
+ return AVERROR(ENOMEM);
}
return 0;
}
@@ -479,6 +482,8 @@ static av_cold void uninit(AVFilterContext *ctx)
av_freep(&s->values);
av_freep(&s->color_lut);
av_freep(&s->max);
+ av_freep(&s->max_persistent);
+ av_freep(&s->nb_frames_max_display);
}
static const AVFilterPad showvolume_inputs[] = {