libnm-glib: do not access NULL GError variable (rh #1224819)
authorJiří Klimeš <jklimes@redhat.com>
Tue, 26 May 2015 13:52:26 +0000 (15:52 +0200)
committerJiří Klimeš <jklimes@redhat.com>
Tue, 26 May 2015 13:59:11 +0000 (15:59 +0200)
dbus_g_proxy_call() should set GError if returning FALSE. But apparently there
is a bug in dbus-glib and the error can be NULL.

https://bugzilla.redhat.com/show_bug.cgi?id=1224819

libnm-glib/nm-client.c

index d62a8b6..40add09 100644 (file)
@@ -782,8 +782,9 @@ nm_client_deactivate_connection (NMClient *client, NMActiveConnection *active)
                                DBUS_TYPE_G_OBJECT_PATH, path,
                                G_TYPE_INVALID,
                                G_TYPE_INVALID)) {
-               g_warning ("Could not deactivate connection '%s': %s", path, error->message);
-               g_error_free (error);
+               g_warning ("Could not deactivate connection '%s': %s", 
+                          path, error ? error->message : "(unknown)");
+               g_clear_error (&error);
        }
 }
 
@@ -1094,8 +1095,9 @@ nm_client_networking_set_enabled (NMClient *client, gboolean enable)
                                G_TYPE_BOOLEAN, enable,
                                G_TYPE_INVALID,
                                G_TYPE_INVALID)) {
-               g_warning ("Error enabling/disabling networking: %s", err->message);
-               g_error_free (err);
+               g_warning ("Error enabling/disabling networking: %s",
+                          err ? err->message : "(unknown)");
+               g_clear_error (&err);
        }
 }