From 7a44ee7f37803b8b1c3829672d07c5328b878456 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Wed, 23 Jun 2021 16:02:35 +0300 Subject: [PATCH] backend-drm: Clean-up minor leak when destroying the DRM-backend Fixes a minor leak due to launcher-libseatd: Direct leak of 32 byte(s) in 1 object(s) allocated from: #0 0x7f15664e5037 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xaa037) #1 0x7f156305c59f in zalloc ../include/libweston/zalloc.h:38 #2 0x7f156305c99b in seat_open_device ../libweston/launcher-libseat.c:114 #3 0x7f1563056341 in weston_launcher_open ../libweston/launcher-util.c:79 #4 0x7f156302f1e2 in drm_device_is_kms ../libweston/backend-drm/drm.c:2616 #5 0x7f156302f751 in find_primary_gpu ../libweston/backend-drm/drm.c:2715 #6 0x7f15630309a5 in drm_backend_create ../libweston/backend-drm/drm.c:2970 #7 0x7f15630317ab in weston_backend_init ../libweston/backend-drm/drm.c:3162 #8 0x7f1566025b61 in weston_compositor_load_backend ../libweston/compositor.c:8201 #9 0x7f156640cb9e in load_drm_backend ../compositor/main.c:2596 #10 0x7f156641193c in load_backend ../compositor/main.c:3079 #11 0x7f1566413cc3 in wet_main ../compositor/main.c:3356 #12 0x562ba484b179 in main ../compositor/executable.c:33 #13 0x7f156624fcc9 in __libc_start_main ../csu/libc-start.c:308 But also use the launcher interface to actually close the DRM fd, in mirror to what weston_launcher_open() does. Signed-off-by: Marius Vlad --- libweston/backend-drm/drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index e7fd788d..6990eac2 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -2515,9 +2515,9 @@ drm_destroy(struct weston_compositor *ec) udev_monitor_unref(b->udev_monitor); udev_unref(b->udev); + weston_launcher_close(ec->launcher, b->drm.fd); weston_launcher_destroy(ec->launcher); - close(b->drm.fd); free(b->drm.filename); free(b); }