summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp
diff options
context:
space:
mode:
authorMarkus Wick <markus@selfnet.de>2015-08-19 11:14:25 +0200
committerMarkus Wick <markus@selfnet.de>2015-08-19 11:14:25 +0200
commitbdbe723d6ec600759650e19d5a1311cc4d15aaf4 (patch)
tree0e2586683280f96dae82a9cefc093a7ab97cf20f /Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp
parent291f857b0e93b734662d975707e95d4766ee891f (diff)
parent3f1055de94d1590dd79adc0e3d4a8067e016de38 (diff)
Merge pull request #2870 from Sonicadvance1/GLInterface_Fix
Fix a memory leak in the EGL GLInterface.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp b/Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp
index 43678e1acc..1adbfb06c6 100644
--- a/Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp
+++ b/Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp
@@ -27,7 +27,6 @@ void cInterfaceEGL::DetectMode()
return;
EGLint num_configs;
- EGLConfig *config = nullptr;
bool supportsGL = false, supportsGLES2 = false, supportsGLES3 = false;
std::array<int, 3> renderable_types = {
EGL_OPENGL_BIT,
@@ -51,16 +50,17 @@ void cInterfaceEGL::DetectMode()
if (!eglChooseConfig( egl_dpy, attribs, nullptr, 0, &num_configs))
{
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
- goto err_exit;
+ continue;
}
- config = new EGLConfig[num_configs];
+ EGLConfig* config = new EGLConfig[num_configs];
// Get all the configurations
if (!eglChooseConfig(egl_dpy, attribs, config, num_configs, &num_configs))
{
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
- goto err_exit;
+ delete[] config;
+ continue;
}
for (int i = 0; i < num_configs; ++i)
@@ -78,6 +78,7 @@ void cInterfaceEGL::DetectMode()
supportsGLES2 = true;
}
}
+ delete[] config;
}
if (supportsGL)
@@ -87,11 +88,8 @@ void cInterfaceEGL::DetectMode()
else if (supportsGLES2)
s_opengl_mode = GLInterfaceMode::MODE_OPENGLES2;
-err_exit:
if (s_opengl_mode == GLInterfaceMode::MODE_DETECT) // Errored before we found a mode
s_opengl_mode = GLInterfaceMode::MODE_OPENGL; // Fall back to OpenGL
- if (config)
- delete[] config;
}
// Create rendering window.