X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Flibnut.c;h=757f9d252a7a7347ff11f3ab2d245f5465c50e3c;hb=b5a69e79c579e6e15e2019ffd34ef0e09aeab586;hp=eafe8165e284dc4d599d3f6029a9e0ce52e5c4a2;hpb=7f92f3d8129f44bc2ed935e9d81735ffdcd9921f;p=ffmpeg diff --git a/libavformat/libnut.c b/libavformat/libnut.c index eafe8165e28..757f9d252a7 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -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; @@ -205,9 +207,13 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { nut_stream_header_tt * s; int ret, i; + if(!nut) + return -1; + if ((ret = nut_read_headers(nut, &s, NULL))) { av_log(avf, AV_LOG_ERROR, " NUT error: %s\n", nut_error(ret)); nut_demuxer_uninit(nut); + priv->nut = NULL; return -1; } @@ -224,6 +230,11 @@ 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); + priv->nut = NULL; + return AVERROR(ENOMEM); + } memcpy(st->codec->extradata, s[i].codec_specific, st->codec->extradata_size); }