diff --git a/src/server/mysql.c b/src/server/mysql.c --- a/src/server/mysql.c +++ b/src/server/mysql.c @@ -177,12 +177,24 @@ distrend_mysql_result_t mysqlQuery(distr int mysqlResultFree(distrend_mysql_result_t result) { + size_t counter; + if(!result) return 0; if(result->pointlesscheck != FORTY_TWO) fprintf(stderr, "%s:%d: I didn't get the type of handle I wanted\n", __FILE__, __LINE__); + /** + Must flush the resultset buffer. + */ + for(counter = 0; + mysql_fetch_row(result->mysqlresult); + counter ++) + ; + if(counter) + fprintf(stderr, "Calling function did not flush all of the rows it should've\n"); + mysql_free_result(result->mysqlresult); free(result);