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

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

On 05/02/2013 05:39 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 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 redhat com>
> ---
>  daemon/remote.c | 78 ++++++++++++++++++++++++++++++++-------------------------
>  1 file changed, 44 insertions(+), 34 deletions(-)


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

Attachment: signature.asc
Description: OpenPGP digital signature

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