diff --git a/libavformat/mov.c b/libavformat/mov.c index 71e68dc9a4..4df3bb2f21 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4357,7 +4357,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) index->track_id = track_id; index->item_count = avio_rb16(pb); - index->items = av_mallocz_array(index->item_count, sizeof(MOVFragmentIndexItem)); + index->items = index->item_count ? av_mallocz_array(index->item_count, sizeof(MOVFragmentIndexItem)) : NULL; if (!index->items) { av_freep(&index);