[libvirt] [PATCH] Ensure nodeinfo struct is initialized to zero

Daniel P. Berrange berrange at redhat.com
Wed Jan 23 18:07:06 UTC 2013


On Wed, Jan 23, 2013 at 06:02:59PM +0000, Richard W.M. Jones wrote:
> On Wed, Jan 23, 2013 at 05:06:35PM +0000, Daniel P. Berrange wrote:
> > > +    memset(nodeinfo, 0, sizeof(nodeinfo));
> > > +
> > 
> > Of course i meant   sizeof(*nodeinfo)
> 
> Yikes.  Doesn't libvirt have some type of VIR_* macro to either catch
> that error systematically or to allocate pre-cleared memory?

No, but i was actually just about to suggest a  VIR_ZERO() macro for
precisely this problem

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