diff options
Diffstat (limited to 'libavformat/libnut.c')
-rw-r--r-- | libavformat/libnut.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libavformat/libnut.c b/libavformat/libnut.c index 4295d67015..7800d4a69c 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -2,20 +2,20 @@ * NUT (de)muxing via libnut * copyright (c) 2006 Oded Shimon <ods15@ods15.dyndns.org> * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -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) { 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) { 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); } |