From ba0bb4227e5d32619e83765f5967a069766996af Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 23 Oct 2014 17:27:01 +0100 Subject: [PATCH] egl_dri2: do not leak dri2_dpy->driver_configs Walk through the list and free each config, and finally free the list itself. Freeing approx 20KiB of memory, according to valgrind. Inspired by a similar patch by enpeng xu. Signed-off-by: Emil Velikov --- src/egl/drivers/dri2/egl_dri2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 20a72438460..dcc323918eb 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -666,6 +666,7 @@ static EGLBoolean dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + unsigned i; _eglReleaseDisplayResources(drv, disp); _eglCleanupDisplay(disp); @@ -706,6 +707,9 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp) break; } + for (i = 0; dri2_dpy->driver_configs[i]; i++) + free((__DRIconfig *) dri2_dpy->driver_configs[i]); + free(dri2_dpy->driver_configs); free(dri2_dpy); disp->DriverData = NULL; -- 2.30.2