g_free() doesn't always free memory



Package:	glib
Version:	1.2.8
Severity:	grave 

>Originator:	 
>Organization:
net
>Synopsis:	g_free
>Class:		sw-bug | doc-bug 
>Gnome-Libs-Release: gnome-libs-1.2.8
>Environment:
	<machine, os, libc version, target, libraries (multiple lines)>
System: SunOS milton 5.6 Generic_105181-19 sun4m sparc SUNW,SPARCstation-5
Architecture: sun4

 

>Description:
	If glib is compiled with --enable-mem-check g_free doesn't free
        memory. 
    http://developer.gnome.org/doc/API/glib/glib-memory-allocation.html
suggests it is supposed to. This is either a doc bug or a software bug

>How-To-Repeat:
	<code/input/activities to reproduce the problem (multiple lines)>

>Fix:

Either state that --enable-mem-check doesn't free memory in the documentation
or change this on line 410 of gmem.c:


#else /* ENABLE_MEM_CHECK */
      free (mem);
#endif /* ENABLE_MEM_CHECK */

To something like this:

#endif /* ENABLE_MEM_CHECK */
      free (mem);

I suspect the free is not desired since some sort of status stuff
seems to be stored in the space of the freed memory. But then, I guess
at least a realloc() down to the right size for this status stuff
would be less piggish.




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