[FFmpeg-devel,02/10] lavf/movenc: fix leak of eac3_priv

Submitted by Rodger Combs on March 14, 2018, 6:24 a.m.

Details

Message ID 20180314062445.89909-2-rodger.combs@gmail.com
State New
Headers show

Commit Message

Rodger Combs March 14, 2018, 6:24 a.m.
This could previously happen in error or early-exit cases. The next commit
would make it happen in all cases.
---
 libavformat/movenc.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 5b1e66c897..accab417f6 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5773,6 +5773,12 @@  static void mov_free(AVFormatContext *s)
         av_freep(&mov->tracks[i].cluster);
         av_freep(&mov->tracks[i].frag_info);
 
+        if (mov->tracks[i].eac3_priv) {
+            struct eac3_info *info = mov->tracks[i].eac3_priv;
+            av_packet_unref(&info->pkt);
+            av_freep(&mov->tracks[i].eac3_priv);
+        }
+
         if (mov->tracks[i].vos_len)
             av_freep(&mov->tracks[i].vos_data);