[FFmpeg-cvslog] avcodec/4xm: use av_fast_padded_malloc()

Paul B Mahol git at videolan.org
Wed Oct 30 12:41:51 CET 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Oct 29 13:37:16 2013 +0000| [2820562935e780acc446e85ce26f03ecbb09b8bd] | committer: Paul B Mahol

avcodec/4xm: use av_fast_padded_malloc()

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2820562935e780acc446e85ce26f03ecbb09b8bd
---

 libavcodec/4xm.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index a73f8d5..eb07cc3 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -461,14 +461,12 @@ static int decode_p_frame(FourXContext *f, AVFrame *frame,
         return AVERROR_INVALIDDATA;
     }
 
-    av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size,
-                   bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
+    av_fast_padded_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size,
+                          bitstream_size);
     if (!f->bitstream_buffer)
         return AVERROR(ENOMEM);
     f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra),
                      bitstream_size / 4);
-    memset((uint8_t*)f->bitstream_buffer + bitstream_size,
-           0, FF_INPUT_BUFFER_PADDING_SIZE);
     init_get_bits(&f->gb, f->bitstream_buffer, 8 * bitstream_size);
 
     wordstream_offset = extra + bitstream_size;
@@ -803,14 +801,12 @@ static int decode_i_frame(FourXContext *f, AVFrame *frame, const uint8_t *buf, i
 
     prestream_size = length + buf - prestream;
 
-    av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size,
-                   prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
+    av_fast_padded_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size,
+                          prestream_size);
     if (!f->bitstream_buffer)
         return AVERROR(ENOMEM);
     f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream,
                      prestream_size / 4);
-    memset((uint8_t*)f->bitstream_buffer + prestream_size,
-           0, FF_INPUT_BUFFER_PADDING_SIZE);
     init_get_bits(&f->pre_gb, f->bitstream_buffer, 8 * prestream_size);
 
     f->last_dc = 0 * 128 * 8 * 8;



More information about the ffmpeg-cvslog mailing list