From nobody Mon Apr 29 20:59:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604669446; cv=none; d=zohomail.com; s=zohoarc; b=IFga49ledK3LB54AN3TpPHm+/+c0l5LBnj0ab5OJoQ9ef5YvRW6EGvIR6TtKvNIcsk8QkFOs9QQqTcVCsa8XwlJzII/DWaONMRWZV3N9Oc++m276mISqOOpUy0umFYcFaCDMl/y/Ut6PPlw1VFQsu0SiOenjYB2slIL+1Vx7oyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604669446; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=lQIMR2n1B12djy361a6vVnooAIPA1O0nElAtBjncJZI=; b=D6CAcZaU3QMJVXrKgs+DW72sb5Y2H3JV8akdN081Z1ZkgEofVITJiZH/y8iLBltICVKVmvijbZgt3O9d7hG+H3gGpRw3htpQVkUHtwnYn7hLHeUJ1FmZckm8x8lpaMXgKBT+lMivD3grvpvpjsnBC0dnnY8SSUWzgrn31HMHMW8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1604669446118684.3971517919966; Fri, 6 Nov 2020 05:30:46 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-110-XirjkdwfOJyHaMDmYKfReQ-1; Fri, 06 Nov 2020 08:30:42 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6AD02186DD24; Fri, 6 Nov 2020 13:30:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46F0A9F63; Fri, 6 Nov 2020 13:30:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0252518408A0; Fri, 6 Nov 2020 13:30:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A6DUYp2020343 for ; Fri, 6 Nov 2020 08:30:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id EB59C6EF70; Fri, 6 Nov 2020 13:30:34 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B11D6EF6E for ; Fri, 6 Nov 2020 13:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604669445; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lQIMR2n1B12djy361a6vVnooAIPA1O0nElAtBjncJZI=; b=HgdyNZXMiRBIC7R5lKcC4x/tSeRM+LYwEE9HSHiLcN45akhpKv7/QQN7VZ2D8Fg4UYR9Q8 zE2qlLe3FZ+a0BBnHrx4aAe8rkPgbiphMh5uDy1u+aEMdpIWcQG/EfN9jYli6rhFoO8zDR zW1SfsJPi9fWKDW2bcxOtn7ecmxSzoI= X-MC-Unique: XirjkdwfOJyHaMDmYKfReQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] virGDBusBusInit: Properly check for error when looking up D-Bus address Date: Fri, 6 Nov 2020 14:30:26 +0100 Message-Id: <7a1fe0c65f6fd4c2ed52e27247558bd652e1ea36.1604669426.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The virGDBusBusInit is supposed to return a reference to requested bus type (system/session) or, if non-shared bus is requested then create a new bus of the type. As an argument, it gets a double pointer to GError which is passed to all g_dbus_*() calls which allocate it on failure. Pretty standard approach. However, since it is a double pointer we must dereference the first level to see if the value is NULL. IOW: if (*error) Signed-off-by: Michal Privoznik Reviewed-by: Pavel Hrdina --- src/util/virgdbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virgdbus.c b/src/util/virgdbus.c index 4360a6acff..19fd7e2fe4 100644 --- a/src/util/virgdbus.c +++ b/src/util/virgdbus.c @@ -55,7 +55,7 @@ virGDBusBusInit(GBusType type, GError **error) return g_bus_get_sync(type, NULL, error); } else { address =3D g_dbus_address_get_for_bus_sync(type, NULL, error); - if (error) + if (*error) return NULL; return g_dbus_connection_new_for_address_sync(address, G_DBUS_CONNECTION_FL= AGS_NONE, --=20 2.26.2