alac: calculate buffer size outside the loop in allocate_buffers()
authorJustin Ruggles <justin.ruggles@gmail.com>
Mon, 9 Jul 2012 20:57:22 +0000 (16:57 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Thu, 19 Jul 2012 17:26:48 +0000 (13:26 -0400)
libavcodec/alac.c

index 7732f17..7c76c62 100644 (file)
@@ -505,9 +505,9 @@ static av_cold int alac_decode_close(AVCodecContext *avctx)
 static int allocate_buffers(ALACContext *alac)
 {
     int ch;
-    for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
-        int buf_size = alac->max_samples_per_frame * sizeof(int32_t);
+    int buf_size = alac->max_samples_per_frame * sizeof(int32_t);
 
+    for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
         FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
                          buf_size, buf_alloc_fail);