egl: _eglCloseDriver should be no-op.
[mesa.git] / src / egl / main / egldisplay.c
index ba7e634c9d602750f46c83714764f3885e670eaa..0693f258dedc4db359d85c8f14934c6e7c7b67a1 100644 (file)
@@ -40,7 +40,6 @@ _eglFiniDisplay(void)
          if (dpy->ContextList || dpy->SurfaceList)
             _eglLog(_EGL_DEBUG, "Display %u is destroyed with resources", key);
 
-         _eglCleanupDisplay(dpy);
          free(dpy);
 
          key = _eglHashNextEntry(_eglDisplayHash, key);
@@ -237,11 +236,13 @@ _eglCleanupDisplay(_EGLDisplay *disp)
 {
    EGLint i;
 
-   for (i = 0; i < disp->NumConfigs; i++) {
-      free(disp->Configs[i]);
+   if (disp->Configs) {
+      for (i = 0; i < disp->NumConfigs; i++)
+         free(disp->Configs[i]);
+      free(disp->Configs);
+      disp->Configs = NULL;
+      disp->NumConfigs = 0;
    }
-   free(disp->Configs);
-   disp->Configs = NULL;
 
    /* XXX incomplete */
 }