From 8b32f9eaad4b22698047768b5a18b9e8466662de Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 9 Jul 2012 21:54:39 -0700 Subject: [PATCH] psppire-window-base: Avoid memory leak in get_window_id(). g_object_get() returns a string copy, so the caller has to free it, but gtk_widget_get_name() gets the same string without a copy. Found by valgrind. --- src/ui/gui/psppire-window-base.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ui/gui/psppire-window-base.c b/src/ui/gui/psppire-window-base.c index 29c0fd7a58..a9f73535df 100644 --- a/src/ui/gui/psppire-window-base.c +++ b/src/ui/gui/psppire-window-base.c @@ -46,10 +46,7 @@ G_DEFINE_ABSTRACT_TYPE (PsppireWindowBase, psppire_window_base, GTK_TYPE_WINDOW) static const char * get_window_id (GtkWidget *wb) { - const gchar *name = NULL; - - g_object_get (wb, "name", &name, NULL); - + const gchar *name = gtk_widget_get_name (wb); if (NULL == name || 0 == strcmp ("", name)) name = G_OBJECT_TYPE_NAME (wb); -- 2.30.2