[libvirt] [PATCH 2/4] parallels: fix memory allocation

Eric Blake eblake at redhat.com
Wed Sep 26 15:00:06 UTC 2012


On 09/26/2012 07:01 AM, Daniel P. Berrange wrote:
> On Wed, Sep 26, 2012 at 04:53:07PM +0400, Dmitry Guryanov wrote:

>>> It is actually preferrable to use VIR_EXPAND_N here, eg
>>>
>>>      if (VIR_EXPAND_N(def->videos, def->nvideos, 1) < 0)
>>>          goto no_memory;
>>>
>>>      def->videos[def->nvideos - 1] = video;
>>>
>>> NB VIR_EXPAND_N actually changes the 'nvideos' param for you
>>>
>>
>> VIR_EXPAND_N expects size_t, but fields storing numbers of devices in
>> virDomainDef have type int, so the error occur:
>>
>> parallels/parallels_driver.c:280: error: passing argument 3 of 'virExpandN' from incompatible pointer type
>> ../src/util/memory.h:55: note: expected 'size_t *' but argument is of type 'int *'

That just says you should be using size_t in your struct, rather than
int.  But like Daniel says, this can be a later cleanup.

> 
> Urgh, I forgot about this. ACK to your first patch.

I've pushed these four patches, as-is.

-- 
Eric Blake   eblake at 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: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120926/d1cefa20/attachment-0001.sig>


More information about the libvir-list mailing list