/* Time to sample atom */
static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track)
{
- MOVStts *stts_entries;
+ MOVStts *stts_entries = NULL;
uint32_t entries = -1;
uint32_t atom_size;
int i;
stts_entries[0].duration = 1;
entries = 1;
} else {
- stts_entries = track->entry ?
- av_malloc(track->entry * sizeof(*stts_entries)) : /* worst case */
- NULL;
- if (!stts_entries)
- return AVERROR(ENOMEM);
+ if (track->entry) {
+ stts_entries = av_malloc(track->entry * sizeof(*stts_entries)); /* worst case */
+ if (!stts_entries)
+ return AVERROR(ENOMEM);
+ }
for (i = 0; i < track->entry; i++) {
int duration = get_cluster_duration(track, i);
if (i && duration == stts_entries[entries].duration) {