[libvirt] [libvirt-glib 2/2] API to save and suspend

Daniel P. Berrange berrange at redhat.com
Tue Jan 3 14:11:32 UTC 2012


On Tue, Jan 03, 2012 at 03:06:09PM +0100, Marc-André Lureau wrote:
> Hi
> 
> On Fri, Dec 23, 2011 at 8:58 PM, Zeeshan Ali (Khattak)
> <zeeshanak at gnome.org>wrote:
> 
> > +    data = g_new0(DomainSavedSuspendData, 1);
> >
> +    g_slice_free (DomainSavedSuspendData, data);
> 
> You are mixing g_new and g_slice, I don't think that's a problem, but
> that's not consistant and worries me.

Actually, I'm fairly sure that is a serious problem. At the very
least it will be a memory leak, but it could well cause other
nasty effects

http://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free1

 "The memory must have been allocated via g_slice_alloc() or g_slice_alloc0()
  and the block_size has to match the size specified upon allocation."

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list