An alternative would be to run all of the tests under a child
thread, and then join it. If the various compilers like this
patch, then it's fine for now.
fr_dict_free(&dict);
/*
- * Free the strerror buffer.
+ * Call pthread destructors. Which aren't normally
+ * called for the main thread.
+ *
+ * Note that pthread_exit() never returns, and always
+ * causes the process to exit with status '0'. So we
+ * check for test failure here, and if so, don't call the
+ * destructors. If the tests fail, who cares about
+ * memory leaks...
*/
- fr_strerror_free();
+ if (ret != 0) return ret;
- return ret;
+ pthread_exit(NULL);
}