git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit8eba875d893721187d8aff187aa4487a44ad8cd2
parent109b2089e0
authorIsaac Freund <[email protected]>
date2023-01-21 14:54
idle-inhibit: fix use-after-free

A user reported a crash that only reproduces when preloading a hardened
malloc implementation. From the stack trace, this use-after-free seems
to be the most likely cause. Yay hardened malloc!

 river/IdleInhibitor.zig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/river/IdleInhibitor.zig b/river/IdleInhibitor.zig
index 6482222..2cebf97 100644
--- a/river/IdleInhibitor.zig
+++ b/river/IdleInhibitor.zig
@@ -28,7 +28,8 @@ fn handleDestroy(listener: *wl.Listener(*wlr.IdleInhibitorV1), _: *wlr.IdleInhib
 
     const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self);
     server.idle_inhibitor_manager.inhibitors.remove(node);
-    util.gpa.destroy(node);
 
     self.inhibitor_manager.idleInhibitCheckActive();
+
+    util.gpa.destroy(node);
 }