ctdb-common: Fix CID 1125581 Dereference after null check (FORWARD_NULL)
authorMartin Schwenke <martin@meltin.net>
Fri, 5 Aug 2016 06:37:00 +0000 (16:37 +1000)
committerKarolin Seeger <kseeger@samba.org>
Wed, 10 Aug 2016 07:03:26 +0000 (09:03 +0200)
This also fixes CID 1125582.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12110

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 7ae3699831427725f12e0a26a0681e59f2fbb2d9)

ctdb/common/rb_tree.c

index 1c602a730b7bed39a9ea6c884e1fa2aeb77f7b6f..f4aee8bf2b8329890a30fe9ff74b08badd276232 100644 (file)
@@ -230,7 +230,7 @@ static inline void trbt_set_color_left(trbt_node_t *node, int color)
 }
 static inline void trbt_set_color_right(trbt_node_t *node, int color)
 {
-       if ( ((node==NULL)||(node->right==NULL)) && (color==TRBT_BLACK) ) {
+       if (node == NULL || node->right == NULL) {
                return;
        }
        node->right->rb_color = color;