pspp-dev
[Top][All Lists]
Advanced

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

[datasets 14/18] gui: Fix g_object_get() memory leaks for PsppireWindow'


From: Ben Pfaff
Subject: [datasets 14/18] gui: Fix g_object_get() memory leaks for PsppireWindow's filename.
Date: Sat, 30 Apr 2011 22:36:42 -0700

g_object_get() makes a copy of strings that it returns, so every call
for "filename" was returning a copied string that the caller did not
free.
---
 src/ui/gui/psppire-data-window.c |    4 ++--
 src/ui/gui/psppire-window.c      |    4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c
index 51b853c..a463ee4 100644
--- a/src/ui/gui/psppire-data-window.c
+++ b/src/ui/gui/psppire-data-window.c
@@ -379,14 +379,14 @@ name_has_suffix (const gchar *name)
 static void
 save_file (PsppireWindow *w)
 {
+  const gchar *file_name = NULL;
   gchar *utf8_file_name = NULL;
-  gchar *file_name = NULL;
   GString *fnx;
   struct string filename ;
   PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (w);
   gchar *syntax;
 
-  g_object_get (w, "filename", &file_name, NULL);
+  file_name = psppire_window_get_filename (w);
 
   fnx = g_string_new (file_name);
 
diff --git a/src/ui/gui/psppire-window.c b/src/ui/gui/psppire-window.c
index a3339ec..332abe3 100644
--- a/src/ui/gui/psppire-window.c
+++ b/src/ui/gui/psppire-window.c
@@ -510,9 +510,7 @@ psppire_window_query_save (PsppireWindow *se)
 const gchar *
 psppire_window_get_filename (PsppireWindow *w)
 {
-  const gchar *name = NULL;
-  g_object_get (w, "filename", &name, NULL);
-  return name;
+  return w->filename;
 }
 
 
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]