As a matter of fact, I think it might still segfault because of the free(rp->tagsets) ? I added a comment to your other PR as well, so let's take it from that one.