[vlc-devel] [PATCH] picture: fix double free when picture_Setup fails

Steve Lhomme robux4 at ycbcr.xyz
Wed Dec 18 14:12:47 CET 2019


The picture (priv->picture which is the same pointer) was freed in
picture_InitPrivate() and then in picture_NewFromResource() /
picture_NewFromFormat().
---
 src/misc/picture.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/misc/picture.c b/src/misc/picture.c
index 990277ef156..89b4ddee62f 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -207,10 +207,7 @@ static bool picture_InitPrivate(const video_format_t *restrict p_fmt,
     p_picture->format = *p_fmt;
     /* Make sure the real dimensions are a multiple of 16 */
     if( picture_Setup( p_picture, p_fmt ) )
-    {
-        free( p_picture );
         return false;
-    }
 
     atomic_init(&p_picture->refs, 1);
     priv->gc.opaque = NULL;
-- 
2.17.1



More information about the vlc-devel mailing list