mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 22:45:21 +00:00
virGDBusBusInit: Properly check for error when looking up D-Bus address
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 <mprivozn@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
7e34d9a9e0
commit
3113f3d815
@ -55,7 +55,7 @@ virGDBusBusInit(GBusType type, GError **error)
|
|||||||
return g_bus_get_sync(type, NULL, error);
|
return g_bus_get_sync(type, NULL, error);
|
||||||
} else {
|
} else {
|
||||||
address = g_dbus_address_get_for_bus_sync(type, NULL, error);
|
address = g_dbus_address_get_for_bus_sync(type, NULL, error);
|
||||||
if (error)
|
if (*error)
|
||||||
return NULL;
|
return NULL;
|
||||||
return g_dbus_connection_new_for_address_sync(address,
|
return g_dbus_connection_new_for_address_sync(address,
|
||||||
G_DBUS_CONNECTION_FLAGS_NONE,
|
G_DBUS_CONNECTION_FLAGS_NONE,
|
||||||
|
Loading…
Reference in New Issue
Block a user