diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2017-01-25 04:13:14 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-01-26 07:05:21 +0100 |
| commit | 72d98ee94360a5da0af76d8e800a72c8d51c48b5 (patch) | |
| tree | c3477667153d1d138518eb63eea83a0afd669bc1 /lib/vector.c | |
| parent | 1e78204400361625235b3e7ea5d2c570b16d7c55 (diff) | |
lib: graph: fix deletions
Iterating over an array while deleting items needs to consider
interactions between the iteration position and deletion. The previous
code completely ignored that problem, leading to memleaks (graph_delete
skipping half of the nodes) and dangling pointers (if parallel edges
exist in graph_remove_edge).
Iterating backwards is safe and reduces "move to fill hole" overhead in
deletion.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Cc: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/vector.c')
0 files changed, 0 insertions, 0 deletions
