diff --git a/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx b/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx
index fb17d100af414e098174c4720abc129c8b415387..6cc5b293ccca85eae27c9a875b90a63cc92d6336 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);