mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/xwma: Use ff_alloc_extradata()
This prevents the fields from potentially becoming inconsistent in case of errors Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
5b911f1d5b
commit
b9fbd034bf
|
@ -104,11 +104,10 @@ static int xwma_read_header(AVFormatContext *s)
|
||||||
avpriv_request_sample(s, "Unexpected extradata (%d bytes)",
|
avpriv_request_sample(s, "Unexpected extradata (%d bytes)",
|
||||||
st->codec->extradata_size);
|
st->codec->extradata_size);
|
||||||
} else {
|
} else {
|
||||||
st->codec->extradata_size = 6;
|
if (ff_alloc_extradata(st->codec, 6))
|
||||||
st->codec->extradata = av_mallocz(6 + FF_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
if (!st->codec->extradata)
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
|
memset(st->codec->extradata, 0, st->codec->extradata_size);
|
||||||
/* setup extradata with our experimentally obtained value */
|
/* setup extradata with our experimentally obtained value */
|
||||||
st->codec->extradata[4] = 31;
|
st->codec->extradata[4] = 31;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue