[PATCH xserver] present: Free the fake_present OsTimerPtr

Olivier Fourdan ofourdan at redhat.com
Mon Aug 8 15:25:35 UTC 2016


Plug a leak in present_fake_queue_vblank() where the OsTimer would not
be freed.

 492,608 (482,816 direct, 9,792 indirect) bytes in 15,088 blocks
are definitely lost in loss record 3,954 of 3,954
    at 0x4C2ABDE: malloc (in vgpreload_memcheck-amd64-linux.so)
    by 0x586B19: TimerSet (WaitFor.c:433)
    by 0x4F1AA9: present_fake_queue_vblank (present_fake.c:108)
    by 0x4F15E0: present_pixmap (present.c:954)
    by 0x4F23B4: proc_present_pixmap (present_request.c:138)
    by 0x552BCE: Dispatch (dispatch.c:430)
    by 0x556C22: dix_main (main.c:300)
    by 0x6F0D290: (below main) (in /usr/lib/libc-2.24.so)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97065
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
 present/present_fake.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/present/present_fake.c b/present/present_fake.c
index 4985c81..2350638 100644
--- a/present/present_fake.c
+++ b/present/present_fake.c
@@ -64,6 +64,7 @@ present_fake_do_timer(OsTimerPtr timer,
 
     present_fake_notify(fake_vblank->screen, fake_vblank->event_id);
     xorg_list_del(&fake_vblank->list);
+    TimerFree(fake_vblank->timer);
     free(fake_vblank);
     return 0;
 }
@@ -75,7 +76,7 @@ present_fake_abort_vblank(ScreenPtr screen, uint64_t event_id, uint64_t msc)
 
     xorg_list_for_each_entry_safe(fake_vblank, tmp, &fake_vblank_queue, list) {
         if (fake_vblank->event_id == event_id) {
-            TimerCancel(fake_vblank->timer);
+            TimerFree(fake_vblank->timer); /* TimerFree will call TimerCancel() */
             xorg_list_del(&fake_vblank->list);
             free (fake_vblank);
             break;
-- 
2.7.4



More information about the xorg-devel mailing list