From 99e881402830806fa8b067f40752ec9a9967f592 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 17 Jul 2013 14:16:37 +0200 Subject: [PATCH] Fixed wrong memory freeing. --- common/gal/opengl/shader.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/gal/opengl/shader.cpp b/common/gal/opengl/shader.cpp index 27b11b25b7..a535f1be69 100644 --- a/common/gal/opengl/shader.cpp +++ b/common/gal/opengl/shader.cpp @@ -164,7 +164,7 @@ void SHADER::programInfo( GLuint aProgram ) wxLogInfo( wxString::FromUTF8( (char*) glInfoLog ) ); - delete glInfoLog; + delete[] glInfoLog; } } @@ -185,7 +185,7 @@ void SHADER::shaderInfo( GLuint aShader ) wxLogInfo( wxString::FromUTF8( (char*) glInfoLog ) ); - delete glInfoLog; + delete[] glInfoLog; } } @@ -246,6 +246,9 @@ bool SHADER::addSource( const std::string& aShaderSource, ShaderType aShaderType glShaderSource( shaderNumber, 1, source_, NULL ); programInfo( programNumber ); + // Delete the allocated char array + delete[] source; + // Compile and attach shader to the program glCompileShader( shaderNumber ); GLint status; @@ -270,9 +273,6 @@ bool SHADER::addSource( const std::string& aShaderSource, ShaderType aShaderType glProgramParameteriEXT( programNumber, GL_GEOMETRY_OUTPUT_TYPE_EXT, geomOutputType ); } - // Delete the allocated char array - delete[] source; - return true; }