You can call the mysql_server_end() function to finalize the C API library.
Syntax
void
mysql_server_end(void)
Return values
None.
Notes
To avoid memory leaks after the application finishes using the library, for example, after the connection to the server is closed, you must explicitly call mysql_server_end() or mysql_library_end() so that memory management is performed to clear and release the resources occupied by the library. We recommend that you call the mysql_library_end() function.