xserver/GL/glx glxcmds.c,1.14,1.15 glxext.c,1.7,1.8
David Reveman <xserver-commit-u7BhqnqprCWvj1b/[email protected]> Fri, 10 Jun 2005 09:02:42 -0700 (PDT)
| Newsgroups | gmane.comp.freedesktop.xserver.cvs |
|---|---|
| Message-ID | <[email protected]> |
Committed by: davidr
Update of /cvs/xserver/xserver/GL/glx
In directory gabe:/tmp/cvs-serv5340/GL/glx
Modified Files:
glxcmds.c glxext.c
Log Message:
Fix a few memory leaks in GLX code
Index: glxcmds.c
===================================================================
RCS file: /cvs/xserver/xserver/GL/glx/glxcmds.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- glxcmds.c 10 Jun 2005 12:30:39 -0000 1.14
+++ glxcmds.c 10 Jun 2005 16:02:39 -0000 1.15
@@ -1047,16 +1047,11 @@
pGlxPixmap->pScreen = pScreen;
pGlxPixmap->idExists = True;
pGlxPixmap->refcnt = 0;
-
- /*
- ** Bump the ref count on the X pixmap so it won't disappear.
- */
- ((PixmapPtr) pDraw)->refcnt++;
-
+
__glXFormatGLModes (&modes, pGlxVisual);
/*
- ** Allocate buffers.
+ ** Allocate buffers.
*/
pGlxPixmap->glxPriv = __glXCreateDrawablePrivate (pDraw, glxpixmapId,
&modes);
@@ -1068,6 +1063,17 @@
__glXRefDrawablePrivate (pGlxPixmap->glxPriv);
+ /*
+ ** Bump the ref count on the X pixmap so it won't disappear.
+ */
+ ((PixmapPtr) pDraw)->refcnt++;
+
+ /*
+ ** XXX: Reset refcnt. Ignores references to this pixmap made by
+ ** __glXCreateDrawablePrivate. Need to fix this.
+ */
+ pGlxPixmap->refcnt = 0;
+
return Success;
}
Index: glxext.c
===================================================================
RCS file: /cvs/xserver/xserver/GL/glx/glxext.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- glxext.c 10 Jun 2005 12:30:39 -0000 1.7
+++ glxext.c 10 Jun 2005 16:02:39 -0000 1.8
@@ -45,9 +45,23 @@
*/
static void ResetExtension(ExtensionEntry* extEntry)
{
+ int i;
+
__glXFlushContextCache();
(*__glXExt->resetExtension)();
__glXScreenReset();
+
+ /*
+ ** Free table of client state. There is never a client 0.
+ */
+ for (i=1; i <= MAXCLIENTS; i++)
+ {
+ if (__glXClients[i])
+ {
+ __glXFree (__glXClients[i]);
+ __glXClients[i] = 0;
+ }
+ }
}
/*
@@ -60,6 +74,7 @@
if (cl->returnBuf) __glXFree(cl->returnBuf);
if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf);
if (cl->currentContexts) __glXFree(cl->currentContexts);
+ if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
__glXMemset(cl, 0, sizeof(__GLXclientState));
/*
** By default, assume that the client supports
@@ -67,8 +82,6 @@
*/
cl->GLClientmajorVersion = 1;
cl->GLClientminorVersion = 0;
- if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
-
}
/*
@@ -167,6 +180,7 @@
}
if (cx->feedbackBuf) __glXFree(cx->feedbackBuf);
if (cx->selectBuf) __glXFree(cx->selectBuf);
+ if (cx->modes) __glXFree(cx->modes);
__glXFree(cx);
if (cx == __glXLastContext) {
__glXFlushContextCache();