[gnome-bluetooth] settings: Fix memory leak when connection fails



commit afddd6da500a8b4fdd6dabdb2d7d8f496277d95f
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Dec 7 16:02:06 2013 +0100

    settings: Fix memory leak when connection fails
    
    The error would be leaked. Also make sure to print the error for
    debugging purposes.

 lib/bluetooth-settings-widget.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index 4f6e822..67b5e81 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -179,11 +179,14 @@ connect_done (GObject      *source_object,
 
                button = GTK_SWITCH (WID ("switch_connection"));
                /* Reset the switch if it failed */
-               if (success == FALSE)
+               if (success == FALSE) {
+                       g_debug ("Connection failed to %s: %s", data->bdaddr, error->message);
                        gtk_switch_set_active (button, !gtk_switch_get_active (button));
+               }
                set_connecting_page (self, CONNECTING_NOTEBOOK_PAGE_SWITCH);
        }
 
+       g_clear_error (&error);
        remove_connecting (self, data->bdaddr);
 
        //FIXME show an error if it failed?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]