[gnome-control-center/wip/tintou/fix-free: 182/182] common: fix some wrong autofree uses



commit a6acc9837174c782e1a18b40224bd9bcbaefa2fa
Author: Corentin Noël <corentin elementary io>
Date:   Mon Jul 9 16:43:47 2018 +0200

    common: fix some wrong autofree uses
    
    g_autofree an array only g_free the first element, GStrv is the string array type.

 shell/cc-panel-list.c | 4 ++--
 shell/cc-panel-list.h | 2 +-
 shell/cc-window.c     | 7 +++----
 3 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/shell/cc-panel-list.c b/shell/cc-panel-list.c
index 39a46b470..070342aba 100644
--- a/shell/cc-panel-list.c
+++ b/shell/cc-panel-list.c
@@ -212,7 +212,7 @@ row_data_new (CcPanelCategory     category,
               const gchar        *id,
               const gchar        *name,
               const gchar        *description,
-              gchar             **keywords,
+              const GStrv         keywords,
               const gchar        *icon,
               CcPanelVisibility   visibility)
 {
@@ -928,7 +928,7 @@ cc_panel_list_add_panel (CcPanelList        *self,
                          const gchar        *id,
                          const gchar        *title,
                          const gchar        *description,
-                         gchar             **keywords,
+                         const GStrv         keywords,
                          const gchar        *icon,
                          CcPanelVisibility   visibility)
 {
diff --git a/shell/cc-panel-list.h b/shell/cc-panel-list.h
index 303ce1d9c..569325908 100644
--- a/shell/cc-panel-list.h
+++ b/shell/cc-panel-list.h
@@ -59,7 +59,7 @@ void                 cc_panel_list_add_panel                     (CcPanelList
                                                                   const gchar        *id,
                                                                   const gchar        *title,
                                                                   const gchar        *description,
-                                                                  gchar             **keywords,
+                                                                  const GStrv         keywords,
                                                                   const gchar        *icon,
                                                                   CcPanelVisibility   visibility);
 
diff --git a/shell/cc-window.c b/shell/cc-window.c
index 9e6f49b85..ad84d5273 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -301,7 +301,7 @@ setup_model (CcWindow *shell)
       g_autofree gchar *name = NULL;
       g_autofree gchar *description = NULL;
       g_autofree gchar *id = NULL;
-      g_autofree GStrv keywords = NULL;
+      g_auto(GStrv) keywords = NULL;
       CcPanelVisibility visibility;
       const gchar *icon_name = NULL;
 
@@ -512,7 +512,7 @@ gdk_window_set_cb (GObject    *object,
                    CcWindow   *self)
 {
   GdkWindow *window;
-  gchar *str;
+  g_autofree gchar *str = NULL;
 
   if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
     return;
@@ -524,7 +524,6 @@ gdk_window_set_cb (GObject    *object,
 
   str = g_strdup_printf ("%u", (guint) GDK_WINDOW_XID (window));
   g_setenv ("GNOME_CONTROL_CENTER_XID", str, TRUE);
-  g_free (str);
 }
 
 static gboolean
@@ -616,7 +615,7 @@ split_decorations_cb (GtkSettings *settings,
   g_autofree gchar *layout = NULL;
   g_autofree gchar *layout_start = NULL;
   g_autofree gchar *layout_end = NULL;
-  g_autofree gchar **buttons;
+  g_auto(GStrv) buttons = NULL;
 
   g_object_get (settings, "gtk-decoration-layout", &layout, NULL);
 


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