summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-02-10 10:24:59 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-04-24 14:22:19 -0700
commit9567fa9a7269765bc59ac71b931e16df261d794d (patch)
tree7c7974008b922fbdf624e92fb69976e3461ca73d /glx
parent7ab98bafc9a3426fd40f8ae693430491333ba4fc (diff)
__glXDRIscreenCreateContext: free context on failure, instead of leaking it
Reported with other leaks found by cppcheck in bugzilla #50281 https://bugs.freedesktop.org/show_bug.cgi?id=50281 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/glxdri.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/glx/glxdri.c b/glx/glxdri.c
index a997e2f8a..1964d2e0c 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -645,8 +645,10 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
for (i = 0; i < pScreen->numVisuals; i++, visual++)
if (visual->vid == glxConfig->visualID)
break;
- if (i == pScreen->numVisuals)
+ if (i == pScreen->numVisuals) {
+ free(context);
return NULL;
+ }
context->hwContextID = FakeClientID(0);
@@ -655,8 +657,10 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
context->hwContextID, &hwContext);
__glXleaveServer(GL_FALSE);
- if (!retval)
+ if (!retval) {
+ free(context);
return NULL;
+ }
context->driContext = screen->legacy->createNewContext(screen->driScreen, config->driConfig, 0, /* render type */
driShare,