input-device: Guard against double free

Dispose() may be called more than once, so calling g_free directly
on the device name is unsafe. Instead, use g_clear_pointer() to
make sure we don't attempt to free the memory again.

https://bugzilla.gnome.org/show_bug.cgi?id=719563
This commit is contained in:
Florian Müllner 2013-11-29 15:43:45 +00:00
parent 2e85269368
commit 992f2ca7b5

View File

@ -81,7 +81,7 @@ clutter_input_device_dispose (GObject *gobject)
{
ClutterInputDevice *device = CLUTTER_INPUT_DEVICE (gobject);
g_free (device->device_name);
g_clear_pointer (&device->device_name, g_free);
if (device->associated != NULL)
{