ctdb-common: Fix CID 1125583 Dereference after null check (FORWARD_NULL)
authorMartin Schwenke <martin@meltin.net>
Fri, 5 Aug 2016 06:38:45 +0000 (16:38 +1000)
committerMartin Schwenke <martins@samba.org>
Mon, 8 Aug 2016 06:17:34 +0000 (08:17 +0200)
This also fixes CID 1125584.

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>
ctdb/common/rb_tree.c

index f4aee8bf2b8329890a30fe9ff74b08badd276232..c3b2b91e3b0c7e21849668dff3fb1142143fdba4 100644 (file)
@@ -223,7 +223,7 @@ static inline void trbt_set_color(trbt_node_t *node, int color)
 }
 static inline void trbt_set_color_left(trbt_node_t *node, int color)
 {
-       if ( ((node==NULL)||(node->left==NULL)) && (color==TRBT_BLACK) ) {
+       if (node == NULL || node->left == NULL) {
                return;
        }
        node->left->rb_color = color;