fixed: was potentially storing stack-allocated name strings in the trackmap
[andemo] / src / rbtree.c
index 765e542..c87c945 100644 (file)
@@ -128,6 +128,12 @@ int rb_size(struct rbtree *rb)
 
 int rb_insert(struct rbtree *rb, void *key, void *data)
 {
+#ifndef NDEBUG
+       int stack_var;
+       if(abs((uintptr_t)&stack_var - (uintptr_t)key) < 0x80000) {
+               fprintf(stderr, "rb_insert warning: key seems to point to the stack\n");
+       }
+#endif
        rb->root = insert(rb, rb->root, key, data);
        rb->root->red = 0;
        return 0;