Reusing faup_handler_t instance is unsafe
Reusing an instance of faup_handler_t will occasionally cause a segfault. Specifically, using an instance faup_handler_t to parse two URLs, one after another (not simultaneously). In my tests, this happens as frequently as once every 100 URLs parsed or as infrequently as once every 100K URLs parsed. But it always happens eventually.
The segfault always occurs in the TLD code. Here are two example backtraces from gdb, showing just the stack frames within libfaup:
#0 faup_tld_tree_tld_exists (Tree=
#0 faup_tld_tree_tld_exists (Tree=
My guess is that there is some lingering state in the faup_handler_t instance that can occasionally cause parsing of a second URL to crash. I've worked around this by always allocating a new instance of faup_handler_t for each URL to be parsed. But this workaround is inefficient.
Good catch! Will work on this, and provide a strong test to make sure we are good there.