MySQL 5.6 C API Developer Guide
void mysql_thread_end(void)
Call this function before calling
pthread_exit()
to free memory allocated by
mysql_thread_init()
.
mysql_thread_end()
is not invoked automatically by the client
library. It must be called explicitly to avoid a
memory leak.