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

Eric Blake eblake at redhat.com
Wed Jan 23 18:12:03 UTC 2013


On 01/23/2013 11:02 AM, 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?

VIR_MALLOC guarantees pre-cleared memory, but in this case, nodeinfo was
passed in by the caller rather than something that we control directly.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130123/8dd3fad3/attachment-0001.sig>


More information about the libvir-list mailing list