← KD100

Fix use-after-free bug in osd_redraw

98c72e16a2535444fb97a061d043433a01a9d222 · Claude · Feb 7, 2026 04:36

Removed XFreeFont call at end of osd_redraw() that was freeing the
font stored in osd->font. The font is now properly loaded once in
osd_init_display() and only freed in osd_destroy().

This fixes crashes and X11 errors when the OSD redraws multiple times.

https://claude.ai/code/session_01H5sr8TkRyt6U1vdkVZRRvy

−4 · 1 file changed

  • src/osd.c +0 −4
diff --git a/src/osd.c b/src/osd.c
index beaaa2c..1e5d89a 100644
--- a/src/osd.c
+++ b/src/osd.c
@@ -515,10 +515,6 @@ void osd_redraw(osd_state_t* osd) {
         }
     }
 
-    if (font) {
-        XFreeFont(dpy, font);
-    }
-
     XFlush(dpy);
 }