summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-11-18 05:28:50 +0100
committerPeter Wu <peter@lekensteyn.nl>2014-11-20 15:59:53 +0100
commit5dd2a3955b753e6d817526ee323ecb32618a8975 (patch)
treeace40bfcf68bf07f434d6d2c1d6df9bdbe754bfa
parent680ff154eafa2a15722d5be3f1b6f4b0bb2d6531 (diff)
downloadupower-5dd2a3955b753e6d817526ee323ecb32618a8975.tar.gz
hidpp: fix memleak for each Feature
The name of each Logitech HID++ 2.0 Feature will now be freed. https://bugs.freedesktop.org/show_bug.cgi?id=82659
-rw-r--r--src/linux/hidpp-device.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/linux/hidpp-device.c b/src/linux/hidpp-device.c
index 106f55a..9a651d8 100644
--- a/src/linux/hidpp-device.c
+++ b/src/linux/hidpp-device.c
@@ -1015,6 +1015,17 @@ out:
}
/**
+ * hidpp_device_free_feature:
+ **/
+static void
+hidpp_device_free_feature (gpointer data)
+{
+ HidppDeviceMap *map = data;
+ g_free (map->name);
+ g_free (map);
+}
+
+/**
* hidpp_device_init:
**/
static void
@@ -1024,7 +1035,7 @@ hidpp_device_init (HidppDevice *device)
device->priv = HIDPP_DEVICE_GET_PRIVATE (device);
device->priv->fd = -1;
- device->priv->feature_index = g_ptr_array_new_with_free_func (g_free);
+ device->priv->feature_index = g_ptr_array_new_with_free_func (hidpp_device_free_feature);
device->priv->batt_status = HIDPP_DEVICE_BATT_STATUS_UNKNOWN;
device->priv->kind = HIDPP_DEVICE_KIND_UNKNOWN;
device->priv->lux = -1;