Commit 6f7f2396 authored by Michael Niedermayer's avatar Michael Niedermayer

libnut: check for av_malloc failure.

No, ive no testcase, i just spoted these when looking ...
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent ec9d9270
......@@ -71,6 +71,8 @@ static int nut_write_header(AVFormatContext * avf) {
int i;
priv->s = s = av_mallocz((avf->nb_streams + 1) * sizeof*s);
if(!s)
return AVERROR(ENOMEM);
for (i = 0; i < avf->nb_streams; i++) {
AVCodecContext * codec = avf->streams[i]->codec;
......@@ -224,6 +226,10 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
st->codec->extradata_size = s[i].codec_specific_len;
if (st->codec->extradata_size) {
st->codec->extradata = av_mallocz(st->codec->extradata_size);
if(!st->codec->extradata){
nut_demuxer_uninit(nut);
return AVERROR(ENOMEM);
}
memcpy(st->codec->extradata, s[i].codec_specific, st->codec->extradata_size);
}
......
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