Re: [PATCH] More paranoid initialization of 'nparams' variable in dispatch code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/02/2013 05:39 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> Since the 'nparams' variable passed to virTypedParametersFree is
> supposed to represent the size of the 'params' array, it is bad
> practice to initialize it to a non-zero value, until the array
> has been allocated.

Thankfully, virTypedParamsFree() does nothing when passed a NULL params
pointer, regardless of the size of nparams, so we had no real bug here;
but I agree that it is wiser to be robust against any future changes in
the code.

> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  daemon/remote.c | 78 ++++++++++++++++++++++++++++++++-------------------------
>  1 file changed, 44 insertions(+), 34 deletions(-)

ACK.

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]