[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: possible bug



> 		while((row = mysql_fetch_row(result_set)) != NULL)
> 		{
> 			some_other_string = row[0];
> 			if(first_record_flag)
> 			{
> 				first_record_flag = FALSE;
> 				somestring = some_other_string;
> 			}
> 			.
> 			.
> 			/* rest of tree loading stuff */
> 			.
> 			.
> 		}

Okay - somewhere down here you should have a call to:
        mysql_free_result();

        I'm betting your problems first occur sometime after that.
Basically mysql frees the string in row[0] when you are finished with
the results.  This is the same data used in some_other_string and
somestring.  Easy fix is to use:
        somestring = g_strdup(some_other_string);

        You will need to call: 
                g_free(somestring);
when you are finished with somestring.  

        This should fix your bug.

        Regards,
        nash
-- 
Brett Nash <nash@nash.nu>
Sometimes it's better to light a flamethrower than curse the darkness.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]