From: Ben Pfaff Date: Mon, 4 Apr 2011 05:02:47 +0000 (-0700) Subject: gui: Fix g_object_get() memory leaks for PsppireWindow's filename. X-Git-Tag: v0.7.8~8 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=d4ae4bc98332969940737c4a5e8f4347f8b9be8c;p=pspp-builds.git gui: Fix g_object_get() memory leaks for PsppireWindow's filename. 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. --- diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index 51b853c1..a463ee43 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 a3339ec8..332abe37 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; }