Re: [PATCH] gdialog core dumps



On Wed, 24 Mar 1999 22:09:18 Jesse D . Sightler wrote:
> -	g_free((gpointer)input); /* allocated by unquote_nl() */
> +	g_free((gpointer)(*input)); /* allocated by unquote_nl() */

Ok, I went to bed at 1AM last night and realized this is just plain wrong.
This time I reinvestigated exactly where the memory is being allocated and what
he was trying to free and found a startling revelation.  This memory really is 
allocated by "unquote_nl()" but is used by several gtk_widgets after this.
The memory that really ought to be "g_free"ed is the memory that was passed
in to the unquote_nl function initially.

Perhaps the best solution in this case, then, is to eliminate the call to g_free
entirely?  Or is there some other way to set this memory free.   I suppose
that you could make the "input" parameter no longer constant and then free it
after the call to "unquote_nl()" (after getting rid of the pointer reuse, there,
of course).  Any suggestions?

---------------
Jesse D. Sightler
http://www3.pair.com/jsight/

"An honest answer can get you into a lot of trouble." 
         - Anonymous



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