Fix a bug in rbtree_delete where node data is freed before it is returned