diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2017-07-24 18:41:30 -0300 |
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2017-07-24 18:50:45 -0300 |
| commit | 145b205177ab47860a78b68329dd4b0ac0d19036 (patch) | |
| tree | 239e20edb36e552345d4d58bda29cb9ba3f81f61 /lib/openbsd-tree.c | |
| parent | 52535beec1fe85682094b625d3f2e19520a803a8 (diff) | |
lib: fix corrupted RB trees
Commit 8f942af90 introduced a bug while silencing a clang warning. Silence
the warning in a different way to fix our red-black tree implementation.
Fixes #841.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/openbsd-tree.c')
| -rw-r--r-- | lib/openbsd-tree.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/openbsd-tree.c b/lib/openbsd-tree.c index 7e753554c9..d171e14d25 100644 --- a/lib/openbsd-tree.c +++ b/lib/openbsd-tree.c @@ -222,12 +222,8 @@ rbe_remove_color(const struct rb_type *t, struct rbt_tree *rbt, { struct rb_entry *tmp; - /* Silence clang possible NULL deference warning. */ - if (parent == NULL) - return; - while ((rbe == NULL || RBE_COLOR(rbe) == RB_BLACK) && - rbe != RBH_ROOT(rbt)) { + rbe != RBH_ROOT(rbt) && parent) { if (RBE_LEFT(parent) == rbe) { tmp = RBE_RIGHT(parent); if (RBE_COLOR(tmp) == RB_RED) { |
