summaryrefslogtreecommitdiff
path: root/libavfilter/avf_showspectrum.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-08-18 18:40:00 +0200
committerPaul B Mahol <onemda@gmail.com>2016-08-18 18:40:00 +0200
commitb3c6e89d4871d4f6afada96d8695e0ef08c6f02b (patch)
tree22c4cfc5c46117622f8bf57fccea7bce3dde1e2c /libavfilter/avf_showspectrum.c
parent703ae350c2deb43a1ab0e83d567db8948a4ae45c (diff)
avfilter/avf_showspectrum: do not use uninitialized memory
Diffstat (limited to 'libavfilter/avf_showspectrum.c')
-rw-r--r--libavfilter/avf_showspectrum.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 5741a1e93d..e65db4fa76 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -380,7 +380,7 @@ static int config_output(AVFilterLink *outlink)
if (!s->color_buffer)
return AVERROR(ENOMEM);
for (i = 0; i < s->nb_display_channels; i++) {
- s->color_buffer[i] = av_malloc_array(s->orientation == VERTICAL ? s->h * 3 : s->w * 3, sizeof(**s->color_buffer));
+ s->color_buffer[i] = av_calloc(s->orientation == VERTICAL ? s->h * 3 : s->w * 3, sizeof(**s->color_buffer));
if (!s->color_buffer[i])
return AVERROR(ENOMEM);
}
@@ -730,8 +730,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)
ctx->internal->execute(ctx, plot_channel, NULL, NULL, s->nb_display_channels);
for (y = 0; y < z * 3; y++) {
- s->combine_buffer[y] += s->color_buffer[0][y];
- for (x = 1; x < s->nb_display_channels; x++) {
+ for (x = 0; x < s->nb_display_channels; x++) {
s->combine_buffer[y] += s->color_buffer[x][y];
}
}