summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorThierry Foucu <tfoucu@gmail.com>2020-05-11 09:35:00 -0700
committerMichael Niedermayer <michael@niedermayer.cc>2020-05-15 22:03:36 +0200
commit1187cbf0ffd7a74f9055def89ff88d5e36a9dbcd (patch)
treedd2f7891cd493ecf0e37a1f6ba2f94ca62a55674 /libavformat
parenta7e1af3cb10b7c914622deff3435bc200000eb65 (diff)
avformat/mov: Read the QT Metadata Keys only once
If you have a file with multiple Metadata Keys, the second time you parse the keys, you will re-alloc c->meta_keys without freeing the old one. This change will avoid parsing all the consecutive Metadata keys. Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mov.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 93648994eb..6490022b1d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7026,7 +7026,8 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
// https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/Metadata/Metadata.html
if (!parse && c->found_hdlr_mdta &&
atom.type == MKTAG('m','e','t','a') &&
- a.type == MKTAG('k','e','y','s')) {
+ a.type == MKTAG('k','e','y','s') &&
+ c->meta_keys_count == 0) {
parse = mov_read_keys;
}