[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(a)redhat.com>