aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/libnut.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-11-28 05:23:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-08 21:21:32 +0100
commit6f7f2396049575fcf2054b4dafa19ca01381638e (patch)
tree8fc2d01ad9c05f6ee882cd60ae056a188b35becf /libavformat/libnut.c
parentec9d92700e490de2a6a5ce7fdcca3e9d113a5b2a (diff)
downloadffmpeg-6f7f2396049575fcf2054b4dafa19ca01381638e.tar.gz
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.c6
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);
}