You can call the mysql_free_result() function to free the memory allocated to a result set.
Syntax
void
mysql_free_result(MYSQL_RES *result)
Return values
None.
Errors
None.
Notes
mysql_free_result() frees the memory allocated to a result set by mysql_store_result(), mysql_use_result(), or mysql_list_dbs(). After you finish using a result set, you must call mysql_free_result() to free the memory allocated to the result set. We recommend that you do not access a result set after freeing it.