From 5f90db5f70289284896ea58ff0296bc01b560006 Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@cnes.fr> Date: Mon, 2 May 2016 17:39:43 +0200 Subject: [PATCH] COMP: Fixing coverity issue 1350185 (null pointer dereference) --- Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx b/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx index fb17d100af..6cc5b293cc 100644 --- a/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx +++ b/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx @@ -71,6 +71,8 @@ void FragmentShaderRegistry::RegisterShader(const std::string& name, const std:: char * logs = new char[length]; glGetShaderInfoLog(shader,1000,&length,logs); + std::string slogs = logs; + delete [] logs; // For safety! logs = NULL; @@ -83,7 +85,7 @@ void FragmentShaderRegistry::RegisterShader(const std::string& name, const std:: glDeleteProgram( program ); program = 0; - itkExceptionMacro(<<"Shader "<<name<<" with sources "<<source<<" failed to compile: "<<logs); + itkExceptionMacro(<<"Shader "<<name<<" with sources "<<source<<" failed to compile: "<<slogs); } glAttachShader(program,shader); -- GitLab