Bug 54106

Summary: Fix a memory leak in dri2_terminate()
Product: Mesa Reporter: Homer Hsing <homer.xing>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Homer Hsing 2012-08-27 07:25:48 UTC
dri2_dpy->driver_name is malloc in dri2_connect but forgot to release.

This patch fix the memory leak.

commit 4f56dedfd6e5093a1ee291af6867c1371b7ae8fd
Author: Homer Hsing <homer.xing@intel.com>
Date:   Mon Aug 27 15:21:41 2012 +0800

    Fix a memory leak in dri2_terminate()

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 7326b85..cfd1cc5 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -613,6 +613,8 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
       dlclose(dri2_dpy->driver);
    if (dri2_dpy->device_name)
       free(dri2_dpy->device_name);
+   if (dri2_dpy->driver_name)
+      free(dri2_dpy->driver_name);
 
    if (disp->PlatformDisplay == NULL) {
       switch (disp->Platform) {
Comment 1 Homer Hsing 2012-08-30 06:03:24 UTC
Hi, any comment ?
Comment 2 Tapani Pälli 2012-08-30 07:59:15 UTC
This patch fixes leak on platforms where driver_name is allocated. However at least with swrast backend and android this would fail as they do not allocate memory but point to a static string.
Comment 3 Tapani Pälli 2014-07-24 05:27:13 UTC
this bug got fixed:
--- 8< ---------------------------
commit 5cb1cad0aef8d1c426207c955996278290e19e60
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Mon Jun 2 12:26:17 2014 +0100

    egl/dri2: do not leak dri2_dpy->driver_name

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.