From fe47a0a1f7c8efa02547c668e0268d9f28611462 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 12 Dec 2025 16:17:50 +1000 Subject: [PATCH] Unref frame events when discarding an empty frame Otherwise we leak that frame event. Part-of: --- src/libei.c | 4 +++- src/libeis.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libei.c b/src/libei.c index 76d4587..7fe9a62 100644 --- a/src/libei.c +++ b/src/libei.c @@ -285,8 +285,10 @@ queue_event(struct ei *ei, struct ei_event *event) break; case EI_EVENT_FRAME: /* silently discard empty frames */ - if (list_empty(&device->pending_event_queue)) + if (list_empty(&device->pending_event_queue)) { + ei_event_unref(event); return; + } struct ei_event *pending; list_for_each_safe(pending, &device->pending_event_queue, link) { diff --git a/src/libeis.c b/src/libeis.c index a83d465..002ee7b 100644 --- a/src/libeis.c +++ b/src/libeis.c @@ -216,8 +216,10 @@ eis_queue_event(struct eis_event *event) break; case EIS_EVENT_FRAME: { /* silently discard empty frames */ - if (list_empty(&device->pending_event_queue)) + if (list_empty(&device->pending_event_queue)) { + eis_event_unref(event); return; + } struct eis_event *pending; list_for_each_safe(pending, &device->pending_event_queue, link) {