# HG changeset patch # User Nathan Phillip Brink # Date 2010-02-18 21:46:11 # Node ID 489f33eeccf46d1c8d69ebff865d7079142275fb # Parent 868944ab533cfca50f27fdd17c2d596f45a42459 Add code to flush mysql result before calling mysql_free_result() 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);