diff mbox

[FFmpeg-devel,2/5] avformat/mov: Fix memleak

Message ID 20190916155502.17579-2-andreas.rheinhardt@gmail.com
State Accepted
Commit 34bd293b014efc816bd7aab068d7f9e4a6d3011a
Headers show

Commit Message

Andreas Rheinhardt Sept. 16, 2019, 3:54 p.m. UTC
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>
---
This only fixes the memleaks from #8150. I can't reproduce the
uninitialized reads, so I can't do anything about them. Can someone else
reproduce them?

 libavformat/mov.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 17, 2019, 12:56 p.m. UTC | #1
On Mon, Sep 16, 2019 at 05:54:59PM +0200, Andreas Rheinhardt wrote:
> 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>
> ---
> This only fixes the memleaks from #8150. I can't reproduce the
> uninitialized reads, so I can't do anything about them. Can someone else
> reproduce them?
> 
>  libavformat/mov.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 675b915906..cd3f5bffcf 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -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;
 }