Memory leak bugfix in BellmanFord (#51)
authorPeter Kovacs <kpeter@inf.elte.hu>
Sun, 13 Dec 2009 22:19:08 +0100
changeset 8044db8d5ccd26b
parent 796 9cc6e98c487d
child 805 d3e32a777d0b
Memory leak bugfix in BellmanFord (#51)
lemon/bellman_ford.h
     1.1 --- a/lemon/bellman_ford.h	Fri Nov 20 14:18:33 2009 +0100
     1.2 +++ b/lemon/bellman_ford.h	Sun Dec 13 22:19:08 2009 +0100
     1.3 @@ -237,7 +237,9 @@
     1.4  	_local_dist = true;
     1.5  	_dist = Traits::createDistMap(*_gr);
     1.6        }
     1.7 -      _mask = new MaskMap(*_gr, false);
     1.8 +      if(!_mask) {
     1.9 +        _mask = new MaskMap(*_gr);
    1.10 +      }
    1.11      }
    1.12      
    1.13    public :
    1.14 @@ -404,6 +406,10 @@
    1.15  	  _process.push_back(it);
    1.16  	  _mask->set(it, true);
    1.17  	}
    1.18 +      } else {
    1.19 +	for (NodeIt it(*_gr); it != INVALID; ++it) {
    1.20 +	  _mask->set(it, false);
    1.21 +	}
    1.22        }
    1.23      }
    1.24