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)
committerMartin Schwenke <martins@samba.org>
Mon, 8 Aug 2016 06:17:34 +0000 (08:17 +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>
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;