summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-11-18 05:28:50 +0100
committerRichard Hughes <richard@hughsie.com>2014-11-26 11:56:12 +0000
commit1f9c094119296e10d9d7144867b689495c6420bd (patch)
treeace40bfcf68bf07f434d6d2c1d6df9bdbe754bfa
parent73927044cb213030e210b46bbc6e4de3aa41ba16 (diff)
downloadupower-1f9c094119296e10d9d7144867b689495c6420bd.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;