On 10/22/14 13:53, Pavel Hrdina wrote:
> An optional argument if not passed isn't modified by the
> PyArg_ParseTuple function.
> 
> Signed-off-by: Pavel Hrdina <[email protected]>
> ---
> 
> Sigh :/, pushed as trivial
> 
>  libvirt-override.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libvirt-override.c b/libvirt-override.c
> index a461eda..a53b46f 100644
> --- a/libvirt-override.c
> +++ b/libvirt-override.c
> @@ -8171,7 +8171,7 @@ libvirt_virDomainBlockCopy(PyObject *self 
> ATTRIBUTE_UNUSED, PyObject *args)
>      char *destxml = NULL;
>      virTypedParameterPtr params = NULL;
>      int nparams = 0;
> -    unsigned int flags;
> +    unsigned int flags = 0;
>      int c_retval;
>  
>      if (!PyArg_ParseTuple(args, (char *) "Ozz|OI:virDomainBlockCopy",
> 

Actually as the python wrapper function generated by generator py looks like:

    def blockCopy(self, disk, destxml, params=None, flags=0):
        """Copy the guest-visible contents of a disk image to a new file 
described by destxml """
        ret = libvirtmod.virDomainBlockCopy(self._o, disk, destxml, params, 
flags)
        if ret == -1: raise libvirtError ('virDomainBlockCopy() failed', 
dom=self)
        return ret

it is guaranteed that both params and flags are initialized. Thus this patch 
isnt necessary.

If it wasn't initialized, the code would have a second problem as PyDict_Check
unconditionally dereferences the passed object.

Peter


Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to