[FFmpeg-devel] [PATCH 31/41] avformat/cafdec: use ff_alloc_extradata()

Paul B Mahol onemda at gmail.com
Sun Oct 13 14:48:52 CEST 2013


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavformat/cafdec.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 337758e..e954c65 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -130,8 +130,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
         }
         avio_read(pb, preamble, ALAC_PREAMBLE);
 
-        st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE);
-        if (!st->codec->extradata)
+        if (ff_alloc_extradata(st->codec, ALAC_HEADER))
             return AVERROR(ENOMEM);
 
         /* For the old style cookie, we skip 12 bytes, then read 36 bytes.
@@ -154,13 +153,10 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
             avio_read(pb, &st->codec->extradata[24], ALAC_NEW_KUKI - 12);
             avio_skip(pb, size - ALAC_NEW_KUKI);
         }
-        st->codec->extradata_size = ALAC_HEADER;
     } else {
-        st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
-        if (!st->codec->extradata)
+        if (ff_alloc_extradata(st->codec, size))
             return AVERROR(ENOMEM);
         avio_read(pb, st->codec->extradata, size);
-        st->codec->extradata_size = size;
     }
 
     return 0;
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list