[FFmpeg-devel] [PATCH 2/2] libnut: check for av_malloc failure.
Michael Niedermayer
michaelni at gmx.at
Mon Nov 28 05:30:08 CET 2011
No, ive no testcase, i just spoted these when looking ...
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavformat/libnut.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/libavformat/libnut.c b/libavformat/libnut.c
index 7628abd..ae6cbb9 100644
--- a/libavformat/libnut.c
+++ b/libavformat/libnut.c
@@ -70,6 +70,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;
@@ -223,6 +225,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);
}
--
1.7.5.4
More information about the ffmpeg-devel
mailing list