From 71bbafadbd35a98921208c3fa74a7fd99941df0c Mon Sep 17 00:00:00 2001 From: Deve Date: Sun, 13 Aug 2017 22:02:55 +0200 Subject: [PATCH] Fixed memory leaks in gles --- lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp | 3 +++ lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp index 85dd171f8..4f4ed1358 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp @@ -1218,6 +1218,9 @@ bool CIrrDeviceLinux::createInputContext() return false; } + // It's showed as memory leak, but we shouldn't delete it. From the xlib + // documentation: "The returned modifiers string is owned by Xlib and + // should not be modified or freed by the client." char* p = XSetLocaleModifiers(""); if (p == NULL) { diff --git a/lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp b/lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp index 77890ecf5..7b86362e7 100644 --- a/lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp +++ b/lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp @@ -432,6 +432,13 @@ namespace video addAndDropMaterialRenderer(new COGLES2ParallaxMapRenderer(PMVSData, PMFSData, EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA, this)); addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_ONETEXTURE_BLEND, this)); + + delete[] FPVSData; + delete[] FPFSData; + delete[] NMVSData; + delete[] NMFSData; + delete[] PMVSData; + delete[] PMFSData; // Create 2D material renderer. @@ -476,6 +483,9 @@ namespace video R2DFSFile->drop(); MaterialRenderer2D = new COGLES2Renderer2D(R2DVSData, R2DFSData, this); + + delete[] R2DVSData; + delete[] R2DFSData; }