Linkgraph: Fix a memory leak when aborting job early.

This commit is contained in:
Jonathan G Rennison
2017-02-08 02:01:27 +00:00
parent 9d5f34fea6
commit 28211c21fc
2 changed files with 2 additions and 4 deletions

View File

@@ -228,7 +228,7 @@ void LinkGraphJob::AbortJob()
void LinkGraphJob::Init() void LinkGraphJob::Init()
{ {
uint size = this->Size(); uint size = this->Size();
this->nodes.Resize(size); this->nodes.resize(size);
this->edges.Resize(size, size); this->edges.Resize(size, size);
for (uint i = 0; i < size; ++i) { for (uint i = 0; i < size; ++i) {
this->nodes[i].Init(this->link_graph[i].Supply()); this->nodes[i].Init(this->link_graph[i].Supply());
@@ -257,8 +257,6 @@ void LinkGraphJob::EdgeAnnotation::Init()
void LinkGraphJob::NodeAnnotation::Init(uint supply) void LinkGraphJob::NodeAnnotation::Init(uint supply)
{ {
this->undelivered_supply = supply; this->undelivered_supply = supply;
new (&this->flows) FlowStatMap;
new (&this->paths) PathList;
} }
/** /**

View File

@@ -52,7 +52,7 @@ private:
void Init(uint supply); void Init(uint supply);
}; };
typedef SmallVector<NodeAnnotation, 16> NodeAnnotationVector; typedef std::vector<NodeAnnotation> NodeAnnotationVector;
typedef SmallMatrix<EdgeAnnotation> EdgeAnnotationMatrix; typedef SmallMatrix<EdgeAnnotation> EdgeAnnotationMatrix;
friend const SaveLoad *GetLinkGraphJobDesc(); friend const SaveLoad *GetLinkGraphJobDesc();