[vlc-commits] vout: fix memory leaks

Rémi Denis-Courmont git at videolan.org
Mon Sep 1 22:05:59 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Sep  1 23:00:38 2014 +0300| [566c4e77d6dbf2b50dc6c2bbee8c577c9b9d62a8] | committer: Rémi Denis-Courmont

vout: fix memory leaks

In combination with the previous patch all crashes (double free()) are solved.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=566c4e77d6dbf2b50dc6c2bbee8c577c9b9d62a8
---

 src/video_output/display.c      |    8 ++++++--
 src/video_output/video_output.c |    2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 547bc2e..614f4d4 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -133,6 +133,9 @@ static void vout_display_Delete(vout_display_t *vd)
     if (vd->module)
         module_unneed(vd, vd->module);
 
+    video_format_Clean(&vd->source);
+    video_format_Clean(&vd->fmt);
+
     vlc_object_release(vd);
 }
 
@@ -467,19 +470,20 @@ static void VoutDisplayCreateRender(vout_display_t *vd)
     es_format_InitFromVideo(&src, &v_src);
 
     /* */
-    es_format_t dst;
-
     filter_t *filter;
     for (int i = 0; i < 1 + (v_dst_cmp.i_chroma != v_dst.i_chroma); i++) {
+        es_format_t dst;
 
         es_format_InitFromVideo(&dst, i == 0 ? &v_dst : &v_dst_cmp);
 
         filter_chain_Reset(osys->filters, &src, &dst);
         filter = filter_chain_AppendFilter(osys->filters,
                                            NULL, NULL, &src, &dst);
+        es_format_Clean(&dst);
         if (filter)
             break;
     }
+    es_format_Clean(&src);
     if (!filter)
         msg_Err(vd, "Failed to adapt decoder format to display");
 }
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 7535a23..3f094d4 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -795,6 +795,8 @@ static void ThreadChangeFilters(vout_thread_t *vout,
         }
     }
 
+    es_format_Clean(&fmt_target);
+
     if (vout->p->filter.configuration != filters) {
         free(vout->p->filter.configuration);
         vout->p->filter.configuration = filters ? strdup(filters) : NULL;



More information about the vlc-commits mailing list