diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-03-12 13:16:38 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-03-19 00:42:27 +0100 |
commit | ea1e15fdc46333f30a49c1d7761b52e589bf78cb (patch) | |
tree | 73284752e0d523e560bc12d8c493863d9ef83263 /libavformat | |
parent | 9224b1f6b3b554dfc5e941bf106bed06816b328c (diff) | |
download | ffmpeg-ea1e15fdc46333f30a49c1d7761b52e589bf78cb.tar.gz |
avformat/mxfdec: Fix leak on error
It was introduced in d3d9b1fc8e2dfc8b4d66c9916ab7221062ff4660;
Fixes Coverity issue #733800.
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mxfdec.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 8fea35b86b..1f372affcb 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2909,8 +2909,12 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF int size = avio_rb16(pb); /* KLV specified by 0x53 */ int64_t next = avio_tell(pb); UID uid = {0}; - if (next < 0 || next > INT64_MAX - size) + if (next < 0 || next > INT64_MAX - size) { + if (meta) { + mxf_free_metadataset(&meta, 1); + } return next < 0 ? next : AVERROR_INVALIDDATA; + } next += size; av_log(mxf->fc, AV_LOG_TRACE, "local tag %#04x size %d\n", tag, size); |