On Wed, 8 Feb 2017 13:05:40 +0000
Mark Thompson <s...@jkqxz.net> wrote:

> On 08/02/17 08:41, Saverio Blasi wrote:

> > +        avctx->extradata = av_malloc(avctx->extradata_size + 
> > AV_INPUT_BUFFER_PADDING_SIZE);
> > +        if (!avctx->extradata) {
> > +            av_log(avctx, AV_LOG_ERROR, "Failed to allocate HEVC extradata 
> > %d bytes\n", avctx->extradata_size);
> > +            av_freep(&encoder_options.argv);
> > +            av_freep(&encoder_options.options);
> > +            turing_destroy_encoder(ctx->encoder);
> > +            return AVERROR(ENOMEM);  
> 
> This cleanup code is copied multiple times, maybe replace them all with a 
> single "fail" path at the end and goto it?  (Like optionfail, but without the 
> message and preserving the error code.)
> 

Could also set FF_CODEC_CAP_INIT_CLEANUP, which will call the close
callback if init fails.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to