mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 03:20:05 +01:00
Fix the scan-build fake leaks
We pass the event to libinput_post_event() where it is appended to the event queue. Except in these three cases clang doesn't seem to realize what's happening and complains about memory leaks. I tried workarounds like g_steal_pointer() but nothing I tried helps. So let's just pretend we're freeing it when clang looks at us. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
822c97a1c2
commit
f206903823
1 changed files with 18 additions and 0 deletions
|
|
@ -2129,6 +2129,12 @@ notify_added_device(struct libinput_device *device)
|
||||||
post_base_event(device,
|
post_base_event(device,
|
||||||
LIBINPUT_EVENT_DEVICE_ADDED,
|
LIBINPUT_EVENT_DEVICE_ADDED,
|
||||||
&added_device_event->base);
|
&added_device_event->base);
|
||||||
|
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
/* clang doesn't realize we're not leaking the event here, so
|
||||||
|
* pretend to free it */
|
||||||
|
free(added_device_event);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -2141,6 +2147,12 @@ notify_removed_device(struct libinput_device *device)
|
||||||
post_base_event(device,
|
post_base_event(device,
|
||||||
LIBINPUT_EVENT_DEVICE_REMOVED,
|
LIBINPUT_EVENT_DEVICE_REMOVED,
|
||||||
&removed_device_event->base);
|
&removed_device_event->base);
|
||||||
|
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
/* clang doesn't realize we're not leaking the event here, so
|
||||||
|
* pretend to free it */
|
||||||
|
free(removed_device_event);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
|
|
@ -2728,6 +2740,12 @@ switch_notify_toggle(struct libinput_device *device,
|
||||||
post_device_event(device, time,
|
post_device_event(device, time,
|
||||||
LIBINPUT_EVENT_SWITCH_TOGGLE,
|
LIBINPUT_EVENT_SWITCH_TOGGLE,
|
||||||
&switch_event->base);
|
&switch_event->base);
|
||||||
|
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
/* clang doesn't realize we're not leaking the event here, so
|
||||||
|
* pretend to free it */
|
||||||
|
free(switch_event);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue