From d8f98990cc76981983a29331c921b5f23142cca3 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 14 Aug 2021 20:21:51 +0200 Subject: [PATCH] mp4: Merge mp4_close() and tag_delete(). The latter is only called by the former, and both are short enough. Don't bother to zero out meta->tags and meta->count because we free the containing mp4 structure as well. --- mp4.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/mp4.c b/mp4.c index ba5146a9..d83bc9df 100644 --- a/mp4.c +++ b/mp4.c @@ -860,21 +860,6 @@ struct mp4 *mp4_open_read(const struct mp4_callback *cb) return f; } -static int32_t tag_delete(struct mp4_metadata *meta) -{ - uint32_t i; - - for (i = 0; i < meta->count; i++) { - free(meta->tags[i].item); - free(meta->tags[i].value); - } - free(meta->tags); - meta->tags = NULL; - meta->count = 0; - - return 0; -} - void mp4_close(struct mp4 *f) { int32_t i; @@ -891,8 +876,11 @@ void mp4_close(struct mp4 *f) free(f->track[i]); } } - - tag_delete(&(f->meta)); + for (i = 0; i < f->meta.count; i++) { + free(f->meta.tags[i].item); + free(f->meta.tags[i].value); + } + free(f->meta.tags); free(f); } -- 2.39.5