st/egl: Manually free configs on terminate.
authorChia-I Wu <olv@lunarg.com>
Wed, 30 Jun 2010 10:21:09 +0000 (18:21 +0800)
committerChia-I Wu <olv@lunarg.com>
Wed, 30 Jun 2010 10:32:48 +0000 (18:32 +0800)
The configs should be FREE()ed, not free()ed.  We cannot rely on
_eglCleanupDisplay here.

src/gallium/state_trackers/egl/common/egl_g3d.c

index 4815a8a322239122d5aa68a75d2e72dbdbc421a5..b6321e6b437589c84a6f7fb1361a2ed5c0c26667 100644 (file)
@@ -424,6 +424,13 @@ static struct native_event_handler egl_g3d_native_event_handler = {
    egl_g3d_new_sw_screen
 };
 
+static void
+egl_g3d_free_config(void *conf)
+{
+   struct egl_g3d_config *gconf = egl_g3d_config((_EGLConfig *) conf);
+   FREE(gconf);
+}
+
 static void
 egl_g3d_free_screen(void *scr)
 {
@@ -438,16 +445,21 @@ egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
    struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
 
    _eglReleaseDisplayResources(drv, dpy);
-   _eglCleanupDisplay(dpy);
 
    if (gdpy->pipe)
       gdpy->pipe->destroy(gdpy->pipe);
 
+   if (dpy->Configs) {
+      _eglDestroyArray(dpy->Configs, egl_g3d_free_config);
+      dpy->Configs = NULL;
+   }
    if (dpy->Screens) {
       _eglDestroyArray(dpy->Screens, egl_g3d_free_screen);
       dpy->Screens = NULL;
    }
 
+   _eglCleanupDisplay(dpy);
+
    if (gdpy->smapi)
       egl_g3d_destroy_st_manager(gdpy->smapi);