From 28211c21fcaea3f74bf80a1eeb8f3b1eecbf669b Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 8 Feb 2017 02:01:27 +0000 Subject: [PATCH] Linkgraph: Fix a memory leak when aborting job early. --- src/linkgraph/linkgraphjob.cpp | 4 +--- src/linkgraph/linkgraphjob.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/linkgraph/linkgraphjob.cpp b/src/linkgraph/linkgraphjob.cpp index 3d97dd2c8c..93158e3ded 100644 --- a/src/linkgraph/linkgraphjob.cpp +++ b/src/linkgraph/linkgraphjob.cpp @@ -228,7 +228,7 @@ void LinkGraphJob::AbortJob() void LinkGraphJob::Init() { uint size = this->Size(); - this->nodes.Resize(size); + this->nodes.resize(size); this->edges.Resize(size, size); for (uint i = 0; i < size; ++i) { this->nodes[i].Init(this->link_graph[i].Supply()); @@ -257,8 +257,6 @@ void LinkGraphJob::EdgeAnnotation::Init() void LinkGraphJob::NodeAnnotation::Init(uint supply) { this->undelivered_supply = supply; - new (&this->flows) FlowStatMap; - new (&this->paths) PathList; } /** diff --git a/src/linkgraph/linkgraphjob.h b/src/linkgraph/linkgraphjob.h index 400e8e19ec..122447867b 100644 --- a/src/linkgraph/linkgraphjob.h +++ b/src/linkgraph/linkgraphjob.h @@ -52,7 +52,7 @@ private: void Init(uint supply); }; - typedef SmallVector NodeAnnotationVector; + typedef std::vector NodeAnnotationVector; typedef SmallMatrix EdgeAnnotationMatrix; friend const SaveLoad *GetLinkGraphJobDesc();