diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-11-18 05:28:50 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-11-18 10:30:40 +0100 |
commit | 7e9df0c95b739cf99f188f5b27548dd0ad6a3af5 (patch) | |
tree | ace40bfcf68bf07f434d6d2c1d6df9bdbe754bfa | |
parent | bae214a8c8a56b3f520db209ffc9903a86810260 (diff) | |
download | upower-7e9df0c95b739cf99f188f5b27548dd0ad6a3af5.tar.gz |
hidpp: fix memleak for each Feature
The name of each Logitech HID++ 2.0 Feature will now be freed.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r-- | src/linux/hidpp-device.c | 13 |
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; |