mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-20 04:20:04 +01:00
lib: Fix error handling in up_client_get_devices2()
In case the assert in up_client_get_devices_full() triggers, 'error'
will still be NULL, making the code cause a NULL pointer dereference
when trying to emit a warning.
Ensure 'error' is non-NULL when trying to generate the warning. If it's
NULL, the failing assert in up_client_get_devices_full() will have
generated an appropriate message already.
Fixes: 74aefb0fd7 ("lib: Add internal helper for up_client_get_devices2()")
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
This commit is contained in:
parent
c5df437cc1
commit
59f31ebed9
1 changed files with 1 additions and 1 deletions
|
|
@ -150,7 +150,7 @@ up_client_get_devices2 (UpClient *client)
|
|||
|
||||
ret = up_client_get_devices_full (client, NULL, &error);
|
||||
if (!ret) {
|
||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
g_warning ("up_client_get_devices failed: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue