[vlc-devel] [PATCH 04/13] vout/opengl: fix an unlikely null dereference

Thomas Guillem thomas at gllm.fr
Mon Dec 12 17:03:45 CET 2016


---
 modules/video_output/opengl.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 2fb062b..a97fe4f 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -673,10 +673,14 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
             continue;
 
         char *infolog = malloc(infoLength);
-        int charsWritten;
-        vgl->GetShaderInfoLog(vgl->shader[j], infoLength, &charsWritten, infolog);
-        fprintf(stderr, "shader %d: %s\n", j, infolog);
-        free(infolog);
+        if (infolog != NULL)
+        {
+            int charsWritten;
+            vgl->GetShaderInfoLog(vgl->shader[j], infoLength, &charsWritten,
+                                  infolog);
+            fprintf(stderr, "shader %d: %s\n", j, infolog);
+            free(infolog);
+        }
     }
 
     /* YUV/XYZ & Vertex shaders */
@@ -698,10 +702,14 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
         if (infoLength <= 1)
             continue;
         char *infolog = malloc(infoLength);
-        int charsWritten;
-        vgl->GetProgramInfoLog(vgl->program[i], infoLength, &charsWritten, infolog);
-        fprintf(stderr, "shader program %d: %s\n", i, infolog);
-        free(infolog);
+        if (infolog != NULL)
+        {
+            int charsWritten;
+            vgl->GetProgramInfoLog(vgl->program[i], infoLength, &charsWritten,
+                                   infolog);
+            fprintf(stderr, "shader program %d: %s\n", i, infolog);
+            free(infolog);
+        }
 
         /* If there is some message, better to check linking is ok */
         GLint link_status = GL_TRUE;
-- 
2.10.2



More information about the vlc-devel mailing list