COIN-OR::LEMON - Graph Library

Ticket #51: 51-bugfix-4db8d5ccd26b.patch

File 51-bugfix-4db8d5ccd26b.patch, 756 bytes (added by Peter Kovacs, 15 years ago)
  • lemon/bellman_ford.h

    # HG changeset patch
    # User Peter Kovacs <kpeter@inf.elte.hu>
    # Date 1260739148 -3600
    # Node ID 4db8d5ccd26bfffa41fe796e55216b3baf4e1d33
    # Parent  9cc6e98c487d3a14fe1db17001f3c4a47350dc80
    Memory leak bugfix in BellmanFord (#51)
    
    diff --git a/lemon/bellman_ford.h b/lemon/bellman_ford.h
    a b  
    237237        _local_dist = true;
    238238        _dist = Traits::createDistMap(*_gr);
    239239      }
    240       _mask = new MaskMap(*_gr, false);
     240      if(!_mask) {
     241        _mask = new MaskMap(*_gr);
     242      }
    241243    }
    242244   
    243245  public :
     
    404406          _process.push_back(it);
    405407          _mask->set(it, true);
    406408        }
     409      } else {
     410        for (NodeIt it(*_gr); it != INVALID; ++it) {
     411          _mask->set(it, false);
     412        }
    407413      }
    408414    }
    409415