Alexandre Julliard : wined3d: Fix a memory leak (spotted by Eric
Pouech).
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Oct 27 08:36:30 CDT 2006
Module: wine
Branch: master
Commit: 00ddebfafaf6b90ee6093dfbbbaa53542a282aec
URL: http://source.winehq.org/git/wine.git/?a=commit;h=00ddebfafaf6b90ee6093dfbbbaa53542a282aec
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Oct 27 14:41:25 2006 +0200
wined3d: Fix a memory leak (spotted by Eric Pouech).
---
dlls/wined3d/directx.c | 10 ++++++----
include/wine/wined3d_gl.h | 1 -
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index e34f4cc..2ef2fd7 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -73,7 +73,7 @@ DWORD minMipLookup[WINED3DTEXF_ANISOTROP
* function query some info from GL
*/
static WineD3D_Context* WineD3D_CreateFakeGLContext(void) {
- static WineD3D_Context ctx = { NULL, NULL, NULL, 0, 0 };
+ static WineD3D_Context ctx;
WineD3D_Context* ret = NULL;
if (glXGetCurrentContext() == NULL) {
@@ -84,6 +84,7 @@ static WineD3D_Context* WineD3D_CreateFa
Visual* visual;
BOOL failed = FALSE;
int num;
+ XVisualInfo *visInfo;
XWindowAttributes win_attr;
TRACE_(d3d_caps)("Creating Fake GL Context\n");
@@ -102,8 +103,8 @@ static WineD3D_Context* WineD3D_CreateFa
visual = DefaultVisual(ctx.display, DefaultScreen(ctx.display));
}
template.visualid = XVisualIDFromVisual(visual);
- ctx.visInfo = XGetVisualInfo(ctx.display, VisualIDMask, &template, &num);
- if (ctx.visInfo == NULL) {
+ visInfo = XGetVisualInfo(ctx.display, VisualIDMask, &template, &num);
+ if (visInfo == NULL) {
LEAVE_GL();
WARN_(d3d_caps)("Error creating visual info for capabilities initialization\n");
failed = TRUE;
@@ -111,7 +112,8 @@ static WineD3D_Context* WineD3D_CreateFa
/* Create a GL context */
if (!failed) {
- ctx.glCtx = glXCreateContext(ctx.display, ctx.visInfo, NULL, GL_TRUE);
+ ctx.glCtx = glXCreateContext(ctx.display, visInfo, NULL, GL_TRUE);
+ XFree( visInfo );
if (ctx.glCtx == NULL) {
LEAVE_GL();
diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h
index 1cc6409..8f29816 100644
--- a/include/wine/wined3d_gl.h
+++ b/include/wine/wined3d_gl.h
@@ -1797,7 +1797,6 @@ #undef USE_GL_FUNC
typedef struct _WineD3D_GLContext {
GLXContext glCtx;
- XVisualInfo* visInfo;
Display* display;
Drawable drawable;
LONG ref;
More information about the wine-cvs
mailing list