diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-30 23:25:19 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-30 23:25:19 +0100 |
commit | 8653419e9d16c9b1e4ecd4221543d919965258a1 (patch) | |
tree | 6aa3476c7b514aaa89c7e5bdeb96e789965f17c3 | |
parent | e5d217f04899e00b5d6af11fa396242649e75cc1 (diff) | |
download | ffmpeg-8653419e9d16c9b1e4ecd4221543d919965258a1.tar.gz |
avformat/mxfdec: Reset structural_components_count when allocation fails
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/mxfdec.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 8aaf4c333f..0c88a8ae9c 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -742,8 +742,10 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID case 0x1001: sequence->structural_components_count = avio_rb32(pb); sequence->structural_components_refs = av_calloc(sequence->structural_components_count, sizeof(UID)); - if (!sequence->structural_components_refs) + if (!sequence->structural_components_refs) { + sequence->structural_components_count = 0; return AVERROR(ENOMEM); + } avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); break; @@ -761,8 +763,10 @@ static int mxf_read_essence_group(void *arg, AVIOContext *pb, int tag, int size, case 0x0501: essence_group->structural_components_count = avio_rb32(pb); essence_group->structural_components_refs = av_calloc(essence_group->structural_components_count, sizeof(UID)); - if (!essence_group->structural_components_refs) + if (!essence_group->structural_components_refs) { + essence_group->structural_components_count = 0; return AVERROR(ENOMEM); + } avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)essence_group->structural_components_refs, essence_group->structural_components_count * sizeof(UID)); break; |