Explorar o código

BUG: Fix memory leak in Core/ctkDependencyGraph

The instantiated QVarLengthArray arrays weren't deleted.
Jean-Christophe Fillion-Robin %!s(int64=15) %!d(string=hai) anos
pai
achega
399e8be1f8
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      Libs/Core/ctkDependencyGraph.cxx

+ 6 - 0
Libs/Core/ctkDependencyGraph.cxx

@@ -221,6 +221,12 @@ ctkDependencyGraph::ctkDependencyGraph(int nvertices, int nedges)
 //----------------------------------------------------------------------------
 ctkDependencyGraph::~ctkDependencyGraph()
 {
+  // Clean memory
+  for (int i=0; i <= this->Internal->NVertices; i++)
+    {
+    delete this->Internal->Edges[i];
+    }
+    
   delete this->Internal; 
 }