[FFmpeg-devel] [PATCH 30/41] avformat/bintext: use ff_alloc_extradata()
Paul B Mahol
onemda at gmail.com
Sun Oct 13 14:48:51 CEST 2013
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavformat/bintext.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/libavformat/bintext.c b/libavformat/bintext.c
index c1c6c00..f04ff18 100644
--- a/libavformat/bintext.c
+++ b/libavformat/bintext.c
@@ -136,9 +136,7 @@ static int bintext_read_header(AVFormatContext *s)
return AVERROR(ENOMEM);
st->codec->codec_id = AV_CODEC_ID_BINTEXT;
- st->codec->extradata_size = 2;
- st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!st->codec->extradata)
+ if (ff_alloc_extradata(st->codec, 2))
return AVERROR(ENOMEM);
st->codec->extradata[0] = 16;
st->codec->extradata[1] = 0;
@@ -194,8 +192,7 @@ static int xbin_read_header(AVFormatContext *s)
st->codec->extradata_size += fontheight * (flags & 0x10 ? 512 : 256);
st->codec->codec_id = flags & 4 ? AV_CODEC_ID_XBIN : AV_CODEC_ID_BINTEXT;
- st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!st->codec->extradata)
+ if (ff_alloc_extradata(st->codec, st->codec->extradata_size))
return AVERROR(ENOMEM);
st->codec->extradata[0] = fontheight;
st->codec->extradata[1] = flags;
@@ -228,7 +225,7 @@ static int adf_read_header(AVFormatContext *s)
st->codec->codec_id = AV_CODEC_ID_BINTEXT;
st->codec->extradata_size = 2 + 48 + 4096;
- st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (ff_alloc_extradata(st->codec, st->codec->extradata_size))
if (!st->codec->extradata)
return AVERROR(ENOMEM);
st->codec->extradata[0] = 16;
@@ -285,8 +282,7 @@ static int idf_read_header(AVFormatContext *s)
st->codec->codec_id = AV_CODEC_ID_IDF;
st->codec->extradata_size = 2 + 48 + 4096;
- st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!st->codec->extradata)
+ if (ff_alloc_extradata(st->codec, st->codec->extradata_size))
return AVERROR(ENOMEM);
st->codec->extradata[0] = 16;
st->codec->extradata[1] = BINTEXT_PALETTE|BINTEXT_FONT;
--
1.7.11.2
More information about the ffmpeg-devel
mailing list