When I comment the indicated line, I don't have any problem. But when I dont I get the "free(): invalid next size (normal)" error. Any help would be appreciated.
Here's the code- Main.c:
MYSQL_RES *result = run_query("SELECT * FROM Zones");
int num_fields = mysql_num_fields(result);
while ((row = mysql_fetch_row(result)))
{
for(i = 0; i < num_fields; i++)
{
printf("%s ", row[i] ? row[i] : "NULL");
}
printf("\n");
}
mysql_free_result(result); /*Problem is with this line*/
And here's the run_query() function:
MYSQL_RES* run_query(char query[200]) {
if (mysql_query(con, query))
{
finish_with_error(con);
}
MYSQL_RES *result = mysql_store_result(con);
if (result == NULL)
{
finish_with_error(con);
}
else{
return result;
}
return NULL;
}