lib: Don't leak thread-local storage for errors on dlclose or exit
If the destructor errors_free() is called, it deletes the thread-local storage storing the last error message in the thread. However this doesn't call the destructor which was registered when the key was created. We have to delete that by hand on this path. Note that we still have the valgrind suppression for this memory leak. That is because in highly multi-threaded programs where one thread calls exit, there's no guarantee that this destructor is called (in fact, it's unlikely) so the memory would still appear to be leaked to valgrind.
parent
f9257a9f