[PATCH v2 evdev 0/3] Memory leak fixes.
peter.hutterer at who-t.net
Tue Mar 8 21:32:29 PST 2011
On Tue, Mar 08, 2011 at 11:23:44AM +0200, Rami Ylimäki wrote:
> XKB options are now released with XkbFreeRMLVOSet.
> The first version of these patches assigned a dynamically allocated
> device filename to a const pointer. Calling free with this pointer
> causes a warning, but this warning was suppressed by casting its
> constness away when calling free. The warning could be alternatively
> avoided by not using a const pointers in the first place.
> In my opinion, using const pointer in this case is completely
> fine. Removing the constness just because the string is dynamically
> allocated isn't necessary. Therefore I prefer keeping the cast instead
> of removing the constness of device filename string.
I realise this is personal preference but I'd prefer const to be used where
the data is actually const and here it certainly isn't.
All three applied, thanks. I've squashed in a removal of a now-unnecessary
typecast char *device = (char*)pEvdev->device into the last patch.
> However, patch 3 of this series can be squashed with the 2nd patch to
> remove the constness. Otherwise the 3rd patch could be just dropped.
> Rami Ylimäki (3):
> Release leaked XKB options on input device disconnect.
> Release leaked device identifier on input device disconnect.
> Remove constness of device filename to avoid warning when freed.
> src/evdev.c | 19 +++++++++++++++++--
> src/evdev.h | 2 +-
> 2 files changed, 18 insertions(+), 3 deletions(-)
More information about the xorg-devel