mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Fix a memory leak in the EGL GLInterface.
This commit is contained in:
parent
4baaa3755e
commit
3f1055de94
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user