[gnome-bluetooth/wip/hadess/cleanups: 3/11] lib: Use g_auto to free short-lived string




commit ce27bd868a957dde4160137f9e8f035bda038e4f
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Feb 10 16:34:18 2021 +0100

    lib: Use g_auto to free short-lived string

 lib/bluetooth-agent.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/lib/bluetooth-agent.c b/lib/bluetooth-agent.c
index 54f2726a..db0f41c2 100644
--- a/lib/bluetooth-agent.c
+++ b/lib/bluetooth-agent.c
@@ -542,7 +542,7 @@ static gboolean
 error_matches_remote_error (GError     *error,
                            const char *remote_error)
 {
-       char *str;
+       g_autofree char *str = NULL;
        gboolean ret;
 
        if (error == NULL)
@@ -550,7 +550,6 @@ error_matches_remote_error (GError     *error,
 
        str = g_dbus_error_get_remote_error (error);
        ret = (g_strcmp0 (str, remote_error) == 0);
-       g_free (str);
 
        return ret;
 }


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