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 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.