[FFmpeg-devel] [PATCH] avcodec/shorten: use av_fast_padded_malloc()

Paul B Mahol onemda at gmail.com
Tue Oct 29 15:01:18 CET 2013


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/shorten.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index b2df2b2..119ae58 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -431,15 +431,13 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
 
     /* allocate internal bitstream buffer */
     if (s->max_framesize == 0) {
-        void *tmp_ptr;
         s->max_framesize = 8192; // should hopefully be enough for the first header
-        tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size,
-                                  s->max_framesize + FF_INPUT_BUFFER_PADDING_SIZE);
-        if (!tmp_ptr) {
+        av_fast_padded_malloc(&s->bitstream, &s->allocated_bitstream_size,
+                              s->max_framesize);
+        if (!s->bitstream) {
             av_log(avctx, AV_LOG_ERROR, "error allocating bitstream buffer\n");
             return AVERROR(ENOMEM);
         }
-        s->bitstream = tmp_ptr;
     }
 
     /* append current packet data to bitstream buffer */
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list