From 4bf08b8d3aa1d37cd2d7730cd5d5ae8891e3ce5b Mon Sep 17 00:00:00 2001 From: CrispPacketTriangle <122162329+crispPacketTriangle@users.noreply.github.com> Date: Sun, 14 Jun 2026 22:06:54 +0200 Subject: [PATCH 1/2] Fix: XVisualInfo memory leak in Renderer_OGL10 --- olcPixelGameEngine.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/olcPixelGameEngine.h b/olcPixelGameEngine.h index 5e59a87a..7b209110 100644 --- a/olcPixelGameEngine.h +++ b/olcPixelGameEngine.h @@ -5320,6 +5320,13 @@ namespace olc #endif public: + // cpt -- free memory for VisualInfo + ~Renderer_OGL10() { + if (olc_VisualInfo) { + X11::XFree(olc_VisualInfo); + olc_VisualInfo = nullptr; + } + } void PrepareDevice() override { #if defined(OLC_PLATFORM_GLUT) From 2708f73b7ff2bbf13f1f6ded588726c63fc5e6da Mon Sep 17 00:00:00 2001 From: CrispPacketTriangle <122162329+crispPacketTriangle@users.noreply.github.com> Date: Sun, 14 Jun 2026 22:29:42 +0200 Subject: [PATCH 2/2] Fix: XVisualInfo memory leak in Renderer_OGL10 --- olcPixelGameEngine.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/olcPixelGameEngine.h b/olcPixelGameEngine.h index 7b209110..47f99c61 100644 --- a/olcPixelGameEngine.h +++ b/olcPixelGameEngine.h @@ -5320,13 +5320,15 @@ namespace olc #endif public: +#if defined(OLC_PLATFORM_X11) // cpt -- free memory for VisualInfo - ~Renderer_OGL10() { - if (olc_VisualInfo) { - X11::XFree(olc_VisualInfo); - olc_VisualInfo = nullptr; - } - } + ~Renderer_OGL10() { + if (olc_VisualInfo) { + X11::XFree(olc_VisualInfo); + olc_VisualInfo = nullptr; + } + } +#endif void PrepareDevice() override { #if defined(OLC_PLATFORM_GLUT)