Commit 56ce2ad2 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by Michael Niedermayer

avformat/mov: Use ff_alloc_extradata for dvdsub extradata

Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: 's avatar"mypopy@gmail.com" <mypopy@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent a87b5d5e
...@@ -2255,7 +2255,7 @@ static int mov_rewrite_dvd_sub_extradata(AVStream *st) ...@@ -2255,7 +2255,7 @@ static int mov_rewrite_dvd_sub_extradata(AVStream *st)
{ {
char buf[256] = {0}; char buf[256] = {0};
uint8_t *src = st->codecpar->extradata; uint8_t *src = st->codecpar->extradata;
int i; int i, ret;
if (st->codecpar->extradata_size != 64) if (st->codecpar->extradata_size != 64)
return 0; return 0;
...@@ -2275,12 +2275,9 @@ static int mov_rewrite_dvd_sub_extradata(AVStream *st) ...@@ -2275,12 +2275,9 @@ static int mov_rewrite_dvd_sub_extradata(AVStream *st)
if (av_strlcat(buf, "\n", sizeof(buf)) >= sizeof(buf)) if (av_strlcat(buf, "\n", sizeof(buf)) >= sizeof(buf))
return 0; return 0;
av_freep(&st->codecpar->extradata); ret = ff_alloc_extradata(st->codecpar, strlen(buf));
st->codecpar->extradata_size = 0; if (ret < 0)
st->codecpar->extradata = av_mallocz(strlen(buf) + AV_INPUT_BUFFER_PADDING_SIZE); return ret;
if (!st->codecpar->extradata)
return AVERROR(ENOMEM);
st->codecpar->extradata_size = strlen(buf);
memcpy(st->codecpar->extradata, buf, st->codecpar->extradata_size); memcpy(st->codecpar->extradata, buf, st->codecpar->extradata_size);
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment