[Spice-devel] [PATCH 1/5] tests: allocate memory in a coherent fashion

Frediano Ziglio fziglio at redhat.com
Tue Dec 15 09:53:52 PST 2015


> 
> On Tue, Dec 15, 2015 at 12:15:09PM +0000, Frediano Ziglio wrote:
> > Do not free memory allocated with C functions (like calloc) using g_free;
> > although this is possible with default Glib allocator this is not safe.
> > Also use consistent allocation functions. All other spice-server code
> > does not use Glib allocations so for coherence do not use them for
> > watches.
> 
> In my opinion, we should aim at deprecating spice_malloc & friends and
> use glib allocation functions instead. With that in mind, in situations
> such as this one, I would have kept the preexisting g_free and used
> g_new0.
> 
> Christophe
> 

Sorry, already merged.

I think would be faster in the future to have some sed/perl/whatever.
Or use g_* functions from spice-common.
Well.. and check perhaps with some runtime that g_free is freeing something
allocated with glib and not something like malloc or strdup.
The main problem is that free should not be replaced so easily with g_free.

Frediano


More information about the Spice-devel mailing list