summaryrefslogtreecommitdiff
path: root/libavformat/mxfdec.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2014-01-07 23:54:09 +0100
committerLuca Barbato <lu_zero@gentoo.org>2014-01-14 18:13:29 +0100
commit1a4e4ad0e0c5486dcab05e54b587672a498dd7cf (patch)
tree5db575580d1ba090a3c72c418ae16b608634b8a3 /libavformat/mxfdec.c
parentf5fbbbc022f723d3ccf99afd5d658a977b51c08a (diff)
mxf: Use av_malloc_array
Diffstat (limited to 'libavformat/mxfdec.c')
-rw-r--r--libavformat/mxfdec.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 2734e14e53..7314ddaffc 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1234,9 +1234,9 @@ static int mxf_compute_index_tables(MXFContext *mxf)
}
}
- if (mxf->nb_index_tables > INT_MAX / sizeof(MXFIndexTable) ||
- !(mxf->index_tables = av_mallocz(mxf->nb_index_tables *
- sizeof(MXFIndexTable)))) {
+ mxf->index_tables = av_mallocz_array(mxf->nb_index_tables,
+ sizeof(*mxf->index_tables));
+ if (!mxf->index_tables) {
av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate index tables\n");
ret = AVERROR(ENOMEM);
goto finish_decoding_index;
@@ -1255,10 +1255,10 @@ static int mxf_compute_index_tables(MXFContext *mxf)
for (i = j = 0; j < mxf->nb_index_tables; i += mxf->index_tables[j++].nb_segments) {
MXFIndexTable *t = &mxf->index_tables[j];
- if (t->nb_segments >
- (INT_MAX / sizeof(MXFIndexTableSegment *)) ||
- !(t->segments = av_mallocz(t->nb_segments *
- sizeof(MXFIndexTableSegment*)))) {
+ t->segments = av_mallocz_array(t->nb_segments,
+ sizeof(*t->segments));
+
+ if (!t->segments) {
av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate IndexTableSegment"
" pointer array\n");
ret = AVERROR(ENOMEM);