Add a goto for init failure instead of duplicate calls to ac3_encode_close().

Originally committed as revision 26030 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Justin Ruggles 2010-12-16 03:44:32 +00:00
parent c41ac4f82e
commit 89bedc4d2e
1 changed files with 5 additions and 4 deletions

View File

@ -1761,19 +1761,20 @@ static av_cold int ac3_encode_init(AVCodecContext *avctx)
s->mdct.avctx = avctx;
ret = mdct_init(&s->mdct, 9);
if (ret) {
ac3_encode_close(avctx);
return ret;
goto init_fail;
}
ret = allocate_buffers(avctx);
if (ret) {
ac3_encode_close(avctx);
return ret;
goto init_fail;
}
avctx->coded_frame= avcodec_alloc_frame();
return 0;
init_fail:
ac3_encode_close(avctx);
return ret;
}