[PATCH weston] linux-dmabuf: Fix crash with no valid modifiers

Derek Foreman derekf at osg.samsung.com
Mon Jun 26 19:44:54 UTC 2017


We shouldn't free &modifier_invalid because it wasn't allocated
with malloc()

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 libweston/linux-dmabuf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libweston/linux-dmabuf.c b/libweston/linux-dmabuf.c
index 4f153b1c..ac219ac3 100644
--- a/libweston/linux-dmabuf.c
+++ b/libweston/linux-dmabuf.c
@@ -509,7 +509,8 @@ bind_linux_dmabuf(struct wl_client *client,
 							  modifier_hi,
 							  modifier_lo);
 		}
-		free(modifiers);
+		if (modifiers != &modifier_invalid)
+			free(modifiers);
 	}
 	free(formats);
 }
-- 
2.13.1



More information about the wayland-devel mailing list