[vlc-commits] image: use es_format_Copy() instead of plain structure copy

Steve Lhomme git at videolan.org
Wed Jul 12 12:22:18 CEST 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Mon Jul 10 09:54:27 2017 +0200| [b840c61553eea5e35bfad8d281f17354d464e13f] | committer: Jean-Baptiste Kempf

image: use es_format_Copy() instead of plain structure copy

There's potentially double free when calling es_format_Clean() on the copied
structure.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/misc/image.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/misc/image.c b/src/misc/image.c
index 20582ef1d6..81c2eae2fc 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -774,10 +774,10 @@ static filter_t *CreateFilter( vlc_object_t *p_this, es_format_t *p_fmt_in,
     p_filter->owner.video.buffer_new =
         (picture_t *(*)(filter_t *))video_new_buffer;
 
-    p_filter->fmt_in = *p_fmt_in;
-    p_filter->fmt_out = *p_fmt_in;
+    es_format_Copy( &p_filter->fmt_in, p_fmt_in );
+    es_format_Copy( &p_filter->fmt_out, p_fmt_in );
+    video_format_Copy( &p_filter->fmt_out.video, p_fmt_out );
     p_filter->fmt_out.i_codec = p_fmt_out->i_chroma;
-    p_filter->fmt_out.video = *p_fmt_out;
     p_filter->p_module = module_need( p_filter, "video converter", NULL, false );
 
     if( !p_filter->p_module )



More information about the vlc-commits mailing list