avl: guard against theoretical null pointer dereference
[project/libubox.git] / avl.c
diff --git a/avl.c b/avl.c
index 8d0bf65aaa5bdaaf83f0910465281a0542e6dfa1..79ea5c798b64dbde78e7a7e445ba84cfc6b7ec33 100644 (file)
--- a/avl.c
+++ b/avl.c
@@ -45,6 +45,7 @@
 #include <string.h>
 
 #include "avl.h"
+#include "assert.h"
 #include "list.h"
 
 /**
@@ -668,6 +669,7 @@ avl_delete_worker(struct avl_tree *tree, struct avl_node *node)
       return;
     }
 
+    assert(node->right);
     node->right->parent = parent;
 
     if (parent->left == node)