Browse Source

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
tags/n0.8
Justin Ruggles 15 years ago
parent
commit
89bedc4d2e
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      libavcodec/ac3enc.c

+ 5
- 4
libavcodec/ac3enc.c View File

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


ret = allocate_buffers(avctx); ret = allocate_buffers(avctx);
if (ret) { if (ret) {
ac3_encode_close(avctx);
return ret;
goto init_fail;
} }


avctx->coded_frame= avcodec_alloc_frame(); avctx->coded_frame= avcodec_alloc_frame();


return 0; return 0;
init_fail:
ac3_encode_close(avctx);
return ret;
} }






Loading…
Cancel
Save