avformat/mov: Fix memleak
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 16 Sep 2019 15:54:59 +0000 (17:54 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 17 Sep 2019 12:41:07 +0000 (14:41 +0200)
When the mov/mp4 demuxer encounters an error during decrypting a packet,
it returns the error, yet doesn't free the packet, so that the packet
leaks. This has been fixed in this commit.

Fixes the memleaks from ticket #8150.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c

index 675b915..cd3f5bf 100644 (file)
@@ -7843,8 +7843,10 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
         aax_filter(pkt->data, pkt->size, mov);
 
     ret = cenc_filter(mov, st, sc, pkt, current_index);
-    if (ret < 0)
+    if (ret < 0) {
+        av_packet_unref(pkt);
         return ret;
+    }
 
     return 0;
 }