[FFmpeg-cvslog] avfilter/af_acopy: check for error cases and handle them
Paul B Mahol
git at videolan.org
Tue Oct 1 14:47:41 EEST 2019
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Oct 1 13:42:18 2019 +0200| [c9473229c9ecffaedbeb3a1d9fe3dbf2d8aee054] | committer: Paul B Mahol
avfilter/af_acopy: check for error cases and handle them
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9473229c9ecffaedbeb3a1d9fe3dbf2d8aee054
---
libavfilter/af_acopy.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/libavfilter/af_acopy.c b/libavfilter/af_acopy.c
index d849060966..a7caec6ae9 100644
--- a/libavfilter/af_acopy.c
+++ b/libavfilter/af_acopy.c
@@ -24,15 +24,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out = ff_get_audio_buffer(outlink, in->nb_samples);
+ int ret;
- if (!out) {
- av_frame_free(&in);
- return AVERROR(ENOMEM);
- }
- av_frame_copy_props(out, in);
- av_frame_copy(out, in);
+ if (!out)
+ ret = AVERROR(ENOMEM);
+
+ ret = av_frame_copy_props(out, in);
+ if (ret < 0)
+ goto fail;
+ ret = av_frame_copy(out, in);
+ if (ret < 0)
+ goto fail;
av_frame_free(&in);
return ff_filter_frame(outlink, out);
+fail:
+ av_frame_free(&in);
+ av_frame_free(&out);
+ return ret;
}
static const AVFilterPad acopy_inputs[] = {
More information about the ffmpeg-cvslog
mailing list