display: correctly init and free hostname

==31043== 7 bytes in 1 blocks are definitely lost in loss record 213 of 6,861
==31043==    at 0x402B018: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==31043==    by 0x417789A: ??? (in /usr/lib/libglib-2.0.so.0.3122.0)
==31043==    by 0x4177C42: g_malloc (in /usr/lib/libglib-2.0.so.0.3122.0)
==31043==    by 0x418DC3A: g_strdup (in /usr/lib/libglib-2.0.so.0.3122.0)
==31043==    by 0x408C470: meta_display_open (display.c:475)
==31043==    by 0x40A4D42: meta_run (main.c:552)
==31043==    by 0x8048A74: main (mutter.c:96)

https://bugzilla.gnome.org/show_bug.cgi?id=672640
This commit is contained in:
Pavel Vasin 2012-03-22 21:42:55 +04:00 committed by Jasper St. Pierre
parent 878b1012b4
commit 12cc0cee29

View File

@ -467,6 +467,8 @@ meta_display_open (void)
buf[sizeof(buf)-1] = '\0'; buf[sizeof(buf)-1] = '\0';
the_display->hostname = g_strdup (buf); the_display->hostname = g_strdup (buf);
} }
else
the_display->hostname = NULL;
the_display->error_trap_synced_at_last_pop = TRUE; the_display->error_trap_synced_at_last_pop = TRUE;
the_display->error_traps = 0; the_display->error_traps = 0;
the_display->error_trap_handler = NULL; the_display->error_trap_handler = NULL;
@ -1044,6 +1046,7 @@ meta_display_close (MetaDisplay *display,
meta_display_free_window_prop_hooks (display); meta_display_free_window_prop_hooks (display);
meta_display_free_group_prop_hooks (display); meta_display_free_group_prop_hooks (display);
g_free (display->hostname);
g_free (display->name); g_free (display->name);
meta_display_shutdown_keys (display); meta_display_shutdown_keys (display);