[vlc-devel] [PATCH 2/2] opengl: fix memory leak in obscure PBO failure case

Niklas Haas vlc at haasn.xyz
Fri Oct 5 21:07:51 CEST 2018


From: Niklas Haas <git at haasn.xyz>

This basically doesn't happen in practice, but we should correctly free
the picture even in this failure path.
---
 modules/video_output/opengl/converter_sw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/video_output/opengl/converter_sw.c b/modules/video_output/opengl/converter_sw.c
index 4a839079b3..6338a1a5c0 100644
--- a/modules/video_output/opengl/converter_sw.c
+++ b/modules/video_output/opengl/converter_sw.c
@@ -156,7 +156,10 @@ pbo_picture_create(const opengl_tex_converter_t *tc, bool direct_rendering)
 
         if( p->i_pitch < 0 || p->i_lines <= 0 ||
             (size_t)p->i_pitch > SIZE_MAX/p->i_lines )
+        {
+            picture_Release(pic);
             return NULL;
+        }
         picsys->bytes[i] = (p->i_pitch * p->i_lines) + 15 / 16 * 16;
     }
     return pic;
-- 
2.19.0



More information about the vlc-devel mailing list