diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2017-07-24 23:41:30 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2017-07-24 23:50:45 +0200 |
commit | 145b205177ab47860a78b68329dd4b0ac0d19036 (patch) | |
tree | 239e20edb36e552345d4d58bda29cb9ba3f81f61 /lib/openbsd-tree.c | |
parent | lib: revert reindent of files imported from OpenBSD (diff) | |
download | frr-145b205177ab47860a78b68329dd4b0ac0d19036.tar.xz frr-145b205177ab47860a78b68329dd4b0ac0d19036.zip |
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 '')
-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 7e753554c..d171e14d2 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) { |