[vlc-commits] es_format: fix rare double free

Thomas Guillem git at videolan.org
Sun Nov 12 18:43:21 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Nov 12 18:42:29 2017 +0100| [71eb04d922b5143588dc4e7dd12f037aff4abe2b] | committer: Thomas Guillem

es_format: fix rare double free

It could happen when i_extra was 0 but p_extra was not NULL (since malloc(0)
can return a valid pointer).

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

 src/misc/es_format.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/misc/es_format.c b/src/misc/es_format.c
index 86f29c4375..9ed9815814 100644
--- a/src/misc/es_format.c
+++ b/src/misc/es_format.c
@@ -492,6 +492,8 @@ int es_format_Copy(es_format_t *restrict dst, const es_format_t *src)
             ret = VLC_ENOMEM;
         }
     }
+    else
+        dst->p_extra = NULL;
 
     if (src->i_cat == VIDEO_ES)
         ret = video_format_Copy( &dst->video, &src->video );



More information about the vlc-commits mailing list