Changeset - 9deea2412c84
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2010-02-19 22:50:29
ohnobinki@ohnopublishing.net
fix mysqlResultFree() segfault issue, actually works finally :-D
1 file changed with 8 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/server/mysql.c
Show inline comments
 
@@ -236,25 +236,29 @@ int mysqlResultFree(distrend_mysql_conn_
 
  free(result);
 

	
 
  /**
 
     Must flush the resultset buffer.
 
   */
 
  for(counter = 0;
 
      mysql_fetch_row(result->mysqlresult);
 
      mysql_fetch_row(mysqlresult);
 
      counter ++)
 
    ;
 
  if(counter)
 
    fprintf(stderr, "Calling function did not flush %d rows\n", (int)counter);
 

	
 
  while(mysql_more_results(conn->mysqlconn))
 
    {
 
      fprintf(stderr, "flushing an extraneous result set\n");
 
      mysql_next_result(conn->mysqlconn);
 
      mysqlresult = mysql_use_result(conn->mysqlconn);
 
      while(mysql_fetch_row(mysqlresult))
 
	;
 
      mysql_free_result(mysqlresult);
 
      if(mysqlresult)
 
	{
 
	  while(mysql_fetch_row(mysqlresult))
 
	    ;
 
	  mysql_free_result(mysqlresult);
 
	}
 
    }
 

	
 
  return 0;
 
}
 

	
 
/*
0 comments (0 inline, 0 general)