mysql_free_result() crashes

Miguel Cardenas <[email protected]> Tue, 20 Sep 2005 00:01:13 -0500
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
Hello

I am a bit confused, have posted to the general list and still don't solve 
this problem... it is simple, the mysql_free_result() C API function crashes 
when I call it...

If I omit the call, the program works fine, but don't know if resources are 
not being free after a query.

Explicitly the error returned after program abortion is this:

*** glibc detected *** double free or corruption (!prev): 0x08051d58 ***
Aborted

Is it a bug or should I omit the usage of this function on the latest version 
of mysql? I saw the online manual and it says

---------------------------
23.2.3.25. mysql_free_result()

void mysql_free_result(MYSQL_RES *result)

Description

Frees the memory allocated for a result set by mysql_store_result(), 
mysql_use_result(), mysql_list_dbs(), etc. When you are done with a result 
set, you must free the memory it uses by calling mysql_free_result(). 
---------------------------

it says clearly "When you are done with a result set, you must free the memory 
it uses by calling mysql_free_result()", so I suppose it is a must to call it 
always after retrieving all rows.

Are there special conditions to use this function? I mean something like when 
to use or not to use it? I already know that only SELECT and queries that 
retrieve rows require to free resources, but maybe when all data is retrieved 
the resources are free automatically, and when not all data is retrieved 
(only the first records when mysql_use_result() is used) is by force?

I don't know if it is a bug or if I am making a mistake. Please let me know if 
there are special conditions for the usage of this function that may not be 
mentioned in the manual...

Thanks for any comment...


-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]