1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avfilter/af_afftdn: fix memory leaks reported by coverity

This commit is contained in:
Paul B Mahol 2018-10-28 22:30:06 +01:00
parent 7070955d43
commit e95987f6ca

View File

@ -1163,15 +1163,13 @@ static int output_frame(AVFilterLink *inlink)
ThreadData td; ThreadData td;
int ret = 0; int ret = 0;
if (!in) { in = ff_get_audio_buffer(outlink, s->window_length);
in = ff_get_audio_buffer(outlink, s->window_length); if (!in)
if (!in) return AVERROR(ENOMEM);
return AVERROR(ENOMEM);
}
ret = av_audio_fifo_peek(s->fifo, (void **)in->extended_data, s->window_length); ret = av_audio_fifo_peek(s->fifo, (void **)in->extended_data, s->window_length);
if (ret < 0) if (ret < 0)
return ret; goto end;
if (s->track_noise) { if (s->track_noise) {
for (int ch = 0; ch < inlink->channels; ch++) { for (int ch = 0; ch < inlink->channels; ch++) {
@ -1248,7 +1246,9 @@ static int output_frame(AVFilterLink *inlink)
dst[m] = orig[m] - src[m]; dst[m] = orig[m] - src[m];
break; break;
default: default:
return AVERROR_BUG; av_frame_free(&out);
ret = AVERROR_BUG;
goto end;
} }
memmove(src, src + s->sample_advance, (s->window_length - s->sample_advance) * sizeof(*src)); memmove(src, src + s->sample_advance, (s->window_length - s->sample_advance) * sizeof(*src));
memset(src + (s->window_length - s->sample_advance), 0, s->sample_advance * sizeof(*src)); memset(src + (s->window_length - s->sample_advance), 0, s->sample_advance * sizeof(*src));