From: Emil Velikov Date: Thu, 23 Oct 2014 16:27:01 +0000 (+0100) Subject: egl_dri2: do not leak dri2_dpy->driver_configs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba0bb4227e5d32619e83765f5967a069766996af;p=mesa.git 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 --- 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;