f->track[f->total_tracks - 1]->decoderConfigLen =
mp4ff_read_mp4_descr_length(f);
- if (f->track[f->total_tracks - 1]->decoderConfig)
- free(f->track[f->total_tracks - 1]->decoderConfig);
+ free(f->track[f->total_tracks - 1]->decoderConfig);
f->track[f->total_tracks - 1]->decoderConfig =
para_malloc(f->track[f->total_tracks - 1]->decoderConfigLen);
if (f->track[f->total_tracks - 1]->decoderConfig) {
tags->tags = (mp4ff_tag_t *) realloc(tags->tags,
(tags->count + 1) * sizeof (mp4ff_tag_t));
if (!tags->tags) {
- if (backup)
- free(backup);
+ free(backup);
return 0;
} else {
tags->tags[tags->count].item = strdup(item);
}
if (!tags->tags[tags->count].item || !tags->tags[tags->count].value) {
- if (!tags->tags[tags->count].item)
- free(tags->tags[tags->count].item);
- if (!tags->tags[tags->count].value)
- free(tags->tags[tags->count].value);
+ free(tags->tags[tags->count].item);
+ free(tags->tags[tags->count].value);
tags->tags[tags->count].item = NULL;
tags->tags[tags->count].value = NULL;
tags->tags[tags->count].len = 0;
done = 1;
}
} else {
- if (data) {
- free(data);
- data = NULL;
- }
+ free(data);
data = mp4ff_read_string(f, (uint32_t) (subsize - (header_size + 8)));
len = (uint32_t) (subsize - (header_size + 8));
}
if (!done) {
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
- if (name)
- free(name);
+ free(name);
name = mp4ff_read_string(f, (uint32_t) (subsize - (header_size + 4)));
}
}
free(data);
}
- if (name)
- free(name);
+ free(name);
return 1;
}
+
static int32_t mp4ff_read_mdhd(mp4ff_t * f)
{
uint32_t version;
uint32_t i;
for (i = 0; i < tags->count; i++) {
- if (tags->tags[i].item)
- free(tags->tags[i].item);
- if (tags->tags[i].value)
- free(tags->tags[i].value);
+ free(tags->tags[i].item);
+ free(tags->tags[i].value);
}
-
- if (tags->tags)
- free(tags->tags);
-
+ free(tags->tags);
tags->tags = NULL;
tags->count = 0;
for (i = 0; i < ff->total_tracks; i++) {
if (ff->track[i]) {
- if (ff->track[i]->stsz_table)
- free(ff->track[i]->stsz_table);
- if (ff->track[i]->stts_sample_count)
- free(ff->track[i]->stts_sample_count);
- if (ff->track[i]->stts_sample_delta)
- free(ff->track[i]->stts_sample_delta);
- if (ff->track[i]->stsc_first_chunk)
- free(ff->track[i]->stsc_first_chunk);
- if (ff->track[i]->stsc_samples_per_chunk)
- free(ff->track[i]->stsc_samples_per_chunk);
- if (ff->track[i]->stsc_sample_desc_index)
- free(ff->track[i]->stsc_sample_desc_index);
- if (ff->track[i]->stco_chunk_offset)
- free(ff->track[i]->stco_chunk_offset);
- if (ff->track[i]->decoderConfig)
- free(ff->track[i]->decoderConfig);
- if (ff->track[i]->ctts_sample_count)
- free(ff->track[i]->ctts_sample_count);
- if (ff->track[i]->ctts_sample_offset)
- free(ff->track[i]->ctts_sample_offset);
+ free(ff->track[i]->stsz_table);
+ free(ff->track[i]->stts_sample_count);
+ free(ff->track[i]->stts_sample_delta);
+ free(ff->track[i]->stsc_first_chunk);
+ free(ff->track[i]->stsc_samples_per_chunk);
+ free(ff->track[i]->stsc_sample_desc_index);
+ free(ff->track[i]->stco_chunk_offset);
+ free(ff->track[i]->decoderConfig);
+ free(ff->track[i]->ctts_sample_count);
+ free(ff->track[i]->ctts_sample_offset);
free(ff->track[i]);
}
}
mp4ff_tag_delete(&(ff->tags));
-
- if (ff)
- free(ff);
+ free(ff);
}
static int32_t mp4ff_chunk_of_sample(const mp4ff_t * f, const int32_t track,
static void membuffer_free(membuffer * buf)
{
- if (buf->data)
- free(buf->data);
+ free(buf->data);
free(buf);
}