Mesa (master): glx: Fix leaks in DRISW screen creation error paths.

Brian Paul brianp at kemper.freedesktop.org
Mon Jan 31 08:32:29 PST 2011


Module: Mesa
Branch: master
Commit: 0b47d59e5be0fb5eb0277f02646914f4a55d35d5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b47d59e5be0fb5eb0277f02646914f4a55d35d5

Author: Henri Verbeet <hverbeet at gmail.com>
Date:   Sat Jan 29 15:00:50 2011 -0800

glx: Fix leaks in DRISW screen creation error paths.

Signed-off-by: Brian Paul <brianp at vmware.com>

---

 src/glx/drisw_glx.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 237ce17..5c7f40c 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -452,8 +452,10 @@ driCreateScreen(int screen, struct glx_display *priv)
       return NULL;
 
    memset(psc, 0, sizeof *psc);
-   if (!glx_screen_init(&psc->base, screen, priv))
-       return NULL;
+   if (!glx_screen_init(&psc->base, screen, priv)) {
+      Xfree(psc);
+      return NULL;
+   }
 
    psc->driver = driOpenSwrast();
    if (psc->driver == NULL)
@@ -504,6 +506,7 @@ driCreateScreen(int screen, struct glx_display *priv)
  handle_error:
    if (psc->driver)
       dlclose(psc->driver);
+   glx_screen_cleanup(&psc->base);
    Xfree(psc);
 
    ErrorMessageF("reverting to indirect rendering\n");



More information about the mesa-commit mailing list