| @@ -1908,16 +1908,14 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx) · 1907 unmodified lines |
| 1908 | // Allocate zeroed memory for the first decoder context | 1908 | // Allocate zeroed memory for the first decoder context |
| 1909 | s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext)); | 1909 | s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext)); |
| 1910 | if (!s->mp3decctx[0]) | 1910 | if (!s->mp3decctx[0]) |
| 1911 | goto alloc_fail; | 1911 | return AVERROR(ENOMEM); |
| 1912 | // Put decoder context in place to make init_decode() happy | 1912 | // Put decoder context in place to make init_decode() happy |
| 1913 | avctx->priv_data = s->mp3decctx[0]; | 1913 | avctx->priv_data = s->mp3decctx[0]; |
| 1914 | ret = decode_init(avctx); | 1914 | ret = decode_init(avctx); |
| 1915 | // Restore mp3on4 context pointer | 1915 | // Restore mp3on4 context pointer |
| 1916 | avctx->priv_data = s; | 1916 | avctx->priv_data = s; |
| 1917 | if (ret < 0) { | 1917 | if (ret < 0) |
| 1918 | decode_close_mp3on4(avctx); | | |
| 1919 | return ret; | 1918 | return ret; |
| 1920 | } | | |
| 1921 | s->mp3decctx[0]->adu_mode = 1; // Set adu mode | 1919 | s->mp3decctx[0]->adu_mode = 1; // Set adu mode |
| 1922 | | 1920 | |
| 1923 | /* Create a separate codec/context for each frame (first is already ok). | 1921 | /* Create a separate codec/context for each frame (first is already ok). |
| @@ -1926,7 +1924,7 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx) · 2 unmodified lines |
| 1926 | for (i = 1; i < s->frames; i++) { | 1924 | for (i = 1; i < s->frames; i++) { |
| 1927 | s->mp3decctx[i] = av_mallocz(sizeof(MPADecodeContext)); | 1925 | s->mp3decctx[i] = av_mallocz(sizeof(MPADecodeContext)); |
| 1928 | if (!s->mp3decctx[i]) | 1926 | if (!s->mp3decctx[i]) |
| 1929 | goto alloc_fail; | 1927 | return AVERROR(ENOMEM); |
| 1930 | s->mp3decctx[i]->adu_mode = 1; | 1928 | s->mp3decctx[i]->adu_mode = 1; |
| 1931 | s->mp3decctx[i]->avctx = avctx; | 1929 | s->mp3decctx[i]->avctx = avctx; |
| 1932 | s->mp3decctx[i]->mpadsp = s->mp3decctx[0]->mpadsp; | 1930 | s->mp3decctx[i]->mpadsp = s->mp3decctx[0]->mpadsp; |
| @@ -1934,9 +1932,6 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx) · 1 unmodified line |
| 1934 | } | 1932 | } |
| 1935 | | 1933 | |
| 1936 | return 0; | 1934 | return 0; |
| 1937 | alloc_fail: | | |
| 1938 | decode_close_mp3on4(avctx); | | |
| 1939 | return AVERROR(ENOMEM); | | |
| 1940 | } | 1935 | } |
| 1941 | | 1936 | |
| 1942 | | 1937 | |