From: Ben Pfaff Date: Tue, 10 Jul 2012 04:54:39 +0000 (-0700) Subject: psppire-window-base: Avoid memory leak in get_window_id(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b32f9eaad4b22698047768b5a18b9e8466662de;p=pspp 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. --- 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);