[libvirt] [PATCH] Add overrides for network port UUID getter/lookup methods

Fabiano Fidêncio fidencio at redhat.com
Thu Jan 2 18:46:40 UTC 2020


[snip]

> +static PyObject *
> +libvirt_virNetworkPortLookupByUUID(PyObject *self ATTRIBUTE_UNUSED,
> +                                   PyObject *args)
> +{
> +    virNetworkPortPtr c_retval;
> +    virNetworkPtr net;
> +    PyObject *pyobj_net;
> +    unsigned char *uuid;
> +    int len;
> +
> +    if (!PyArg_ParseTuple(args, (char *)"Oz#:virNetworkPortLookupByUUID",
> +                          &pyobj_net, &uuid, &len))
> +        return NULL;
> +    net = (virNetworkPtr) PyvirNetwork_Get(pyobj_net);
> +

Shouldn't we also check whether net is NULL here?

> +    if ((uuid == NULL) || (len != VIR_UUID_BUFLEN))
> +        return VIR_PY_NONE;
> +
> +    LIBVIRT_BEGIN_ALLOW_THREADS;
> +    c_retval = virNetworkPortLookupByUUID(net, uuid);
> +    LIBVIRT_END_ALLOW_THREADS;
> +
> +    return libvirt_virNetworkPortPtrWrap((virNetworkPortPtr) c_retval);
> +}
> +

[snip]

With that fixed, Reviewed-by: Fabiano Fidêncio <fidencio at redhat.com>





More information about the libvir-list mailing list