[gnome-initial-setup] summary: Make sure we free filename of ui resource



commit 48a4389440fb65c64999436b32d9ef58e3c3b945
Author: Michael Wood <michael g wood intel com>
Date:   Wed Dec 5 17:04:42 2012 +0000

    summary: Make sure we free filename of ui resource
    
    Also move the declaration of resource path to top to correctly avoid
    compiler warnings.

 .../pages/summary/gis-summary-page.c               |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c b/gnome-initial-setup/pages/summary/gis-summary-page.c
index d893786..2883dbc 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -250,6 +250,7 @@ gis_summary_page_get_builder (GisPage *page)
 
   char *filename = g_build_filename (UIDIR, "summary-distro.ui", NULL);
   GError *error = NULL;
+  const char *resource_path = "/ui/gis-" PAGE_ID "-page.ui";
 
   if (gtk_builder_add_from_file (builder, filename, &error))
     goto out;
@@ -259,17 +260,15 @@ gis_summary_page_get_builder (GisPage *page)
 
   g_clear_error (&error);
 
-  {
-    char *resource_path = "/ui/gis-" PAGE_ID "-page.ui";
-    gtk_builder_add_from_resource (builder, resource_path, &error);
+  gtk_builder_add_from_resource (builder, resource_path, &error);
 
-    if (error != NULL) {
-      g_warning ("Error while loading %s: %s", resource_path, error->message);
-      exit (1);
-    }
+  if (error != NULL) {
+    g_warning ("Error while loading %s: %s", resource_path, error->message);
+    exit (1);
   }
 
  out:
+  g_free (filename);
   return builder;
 }
 



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