Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 19384357 authored by Sylvain Thery's avatar Sylvain Thery
Browse files

Remove last memory leadk (clean with valgrind now)

parent cbaa11ce
...@@ -149,7 +149,7 @@ bool AttributeContainer::removeAttribute(const std::string& attribName) ...@@ -149,7 +149,7 @@ bool AttributeContainer::removeAttribute(const std::string& attribName)
if (index == UNKNOWN) if (index == UNKNOWN)
{ {
std::cerr << "removeAttribute by name: attribute not found" << std::endl ; std::cerr << "removeAttribute by name: attribute not found (" << attribName << ")"<< std::endl ;
return false ; return false ;
} }
......
...@@ -48,6 +48,18 @@ AttributeContainer::AttributeContainer() : ...@@ -48,6 +48,18 @@ AttributeContainer::AttributeContainer() :
AttributeContainer::~AttributeContainer() AttributeContainer::~AttributeContainer()
{ {
for (unsigned int index = 0; index < m_tableAttribs.size(); ++index)
{
if (m_tableAttribs[index] != NULL)
delete m_tableAttribs[index];
}
for (unsigned int index = 0; index < m_holesBlocks.size(); ++index)
{
if (m_holesBlocks[index] != NULL)
delete m_holesBlocks[index];
}
} }
/************************************** /**************************************
......
...@@ -207,6 +207,7 @@ bool GLSLShader::loadVertexShader( const std::string& filename ) ...@@ -207,6 +207,7 @@ bool GLSLShader::loadVertexShader( const std::string& filename )
if (m_vertex_shader_source) if (m_vertex_shader_source)
delete [] m_vertex_shader_source; delete [] m_vertex_shader_source;
m_vertex_shader_source = NULL;
m_vertex_shader_source = loadSourceFile( filename ); m_vertex_shader_source = loadSourceFile( filename );
...@@ -230,6 +231,7 @@ bool GLSLShader::loadFragmentShader(const std::string& filename ) ...@@ -230,6 +231,7 @@ bool GLSLShader::loadFragmentShader(const std::string& filename )
if (m_fragment_shader_source) if (m_fragment_shader_source)
delete [] m_fragment_shader_source; delete [] m_fragment_shader_source;
m_fragment_shader_source = NULL;
m_fragment_shader_source = loadSourceFile( filename ); m_fragment_shader_source = loadSourceFile( filename );
...@@ -586,6 +588,13 @@ GLSLShader::~GLSLShader() ...@@ -586,6 +588,13 @@ GLSLShader::~GLSLShader()
glDeleteObjectARB( m_program_object ); glDeleteObjectARB( m_program_object );
} }
if (m_vertex_shader_source != NULL)
delete[] m_vertex_shader_source;
if (m_fragment_shader_source != NULL)
delete[] m_fragment_shader_source;
if (m_geom_shader_source != NULL)
delete[] m_geom_shader_source;
// m_registeredShaders.erase(this); // m_registeredShaders.erase(this);
} }
...@@ -702,6 +711,7 @@ bool GLSLShader::loadShadersFromMemory(const char* vs, const char* fs) ...@@ -702,6 +711,7 @@ bool GLSLShader::loadShadersFromMemory(const char* vs, const char* fs)
{ {
if (m_vertex_shader_source) if (m_vertex_shader_source)
delete [] m_vertex_shader_source; delete [] m_vertex_shader_source;
m_vertex_shader_source = NULL;
unsigned int sz = strlen(vs); unsigned int sz = strlen(vs);
m_vertex_shader_source = new char[sz+1]; m_vertex_shader_source = new char[sz+1];
...@@ -730,9 +740,11 @@ bool GLSLShader::loadShadersFromMemory(const char* vs, const char* fs, const cha ...@@ -730,9 +740,11 @@ bool GLSLShader::loadShadersFromMemory(const char* vs, const char* fs, const cha
{ {
if (m_vertex_shader_source) if (m_vertex_shader_source)
delete [] m_vertex_shader_source; delete [] m_vertex_shader_source;
m_vertex_shader_source = NULL;
unsigned int sz = strlen(vs); unsigned int sz = strlen(vs);
m_vertex_shader_source = new char[sz+1]; m_vertex_shader_source = new char[sz+1];
strcpy(m_vertex_shader_source,vs); strcpy(m_vertex_shader_source,vs);
if (m_fragment_shader_source) if (m_fragment_shader_source)
...@@ -771,9 +783,11 @@ bool GLSLShader::reloadVertexShaderFromMemory(const char* vs) ...@@ -771,9 +783,11 @@ bool GLSLShader::reloadVertexShaderFromMemory(const char* vs)
{ {
if (m_vertex_shader_source) if (m_vertex_shader_source)
delete [] m_vertex_shader_source; delete [] m_vertex_shader_source;
m_vertex_shader_source = NULL;
unsigned int sz = strlen(vs); unsigned int sz = strlen(vs);
m_vertex_shader_source = new char[sz+1]; m_vertex_shader_source = new char[sz+1];
strcpy(m_vertex_shader_source,vs); strcpy(m_vertex_shader_source,vs);
return true; return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment