[vlc-commits] vout/opengl: fix an unlikely null dereference

Thomas Guillem git at videolan.org
Tue Dec 13 17:11:01 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Dec  8 13:39:55 2016 +0100| [036eea961c75c9018a9cf8803322075aa4ee003e] | committer: Thomas Guillem

vout/opengl: fix an unlikely null dereference

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

 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 8ccff38..b98f969 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -670,10 +670,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 */
@@ -695,10 +699,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;



More information about the vlc-commits mailing list