diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-28 08:23:48 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-12-09 00:21:32 +0400 |
commit | 6f7f2396049575fcf2054b4dafa19ca01381638e (patch) | |
tree | 8fc2d01ad9c05f6ee882cd60ae056a188b35becf /libavformat/libnut.c | |
parent | ec9d92700e490de2a6a5ce7fdcca3e9d113a5b2a (diff) |
libnut: check for av_malloc failure.
No, ive no testcase, i just spoted these when looking ...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/libnut.c')
-rw-r--r-- | libavformat/libnut.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/libnut.c b/libavformat/libnut.c index eafe8165e2..9f64544d2a 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; @@ -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); } |