diff options
author | Marton Balint <cus@passwd.hu> | 2016-02-20 01:52:25 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2016-02-28 23:00:45 +0100 |
commit | e22bd239c046014652a3487f542f2ab7b34f7a62 (patch) | |
tree | fde8fa7c36c135c8936c028ab34b7d268c3594ee | |
parent | 4840effe4222e5cf3fe78840f9815a613a64c9f8 (diff) |
avformat/mov: do not leak memory on ffio_read_size failure
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r-- | libavformat/mov.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 248a155e9b..043f4a9dbc 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3178,6 +3178,7 @@ static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom) int64_t end = avio_tell(pb) + atom.size; uint8_t *key = NULL, *val = NULL, *mean = NULL; int i; + int ret = 0; AVStream *st; MOVStreamContext *sc; @@ -3189,7 +3190,6 @@ static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < 3; i++) { uint8_t **p; uint32_t len, tag; - int ret; if (end - avio_tell(pb) <= 12) break; @@ -3219,7 +3219,7 @@ static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom) ret = ffio_read_size(pb, *p, len); if (ret < 0) { av_freep(p); - return ret; + break; } (*p)[len] = 0; } @@ -3246,7 +3246,7 @@ static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_freep(&key); av_freep(&val); av_freep(&mean); - return 0; + return ret; } static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom) |