virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt)
{
    virDomainVsockDefPtr ret = NULL;
    virDomainVsockDefPtr vsock;

    if (VIR_ALLOC(vsock) < 0)
        return NULL;

    if (xmlopt &&
        xmlopt->privateData.vsockNew &&
        !(vsock->privateData = xmlopt->privateData.vsockNew()))
        goto cleanup;

    ret = g_steal_pointer(&vsock);
 cleanup:
    virDomainVsockDefFree(vsock);
    return ret;
}
virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt)
{
    virDomainVsockDefPtr ret = NULL;
    virDomainVsockDefPtr vsock;

    if (VIR_ALLOC(vsock) < 0)
        return NULL;

    if (xmlopt &&
        xmlopt->privateData.vsockNew &&
        !(vsock->privateData = xmlopt->privateData.vsockNew()))
        goto cleanup;

    ret = g_steal_pointer(&vsock);
 cleanup:
    virDomainVsockDefFree(vsock);
    return ret;
}