summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYounes Manton <younes.m@gmail.com>2008-07-19 16:22:56 -0400
committerYounes Manton <younes.m@gmail.com>2008-07-20 19:16:41 -0400
commitc243573fafe8e83d4964535b201c499164d7c172 (patch)
tree41781847321e2a775b7d21f52a6587b37ee4f4ea /src
parent8878d8d4b35c9550632f5684bdc97f3958bf43c5 (diff)
g3dvl: Fix some memory leaks in the winsys.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_context.c2
-rw-r--r--src/gallium/winsys/g3dvl/xsp_winsys.c26
-rw-r--r--src/gallium/winsys/g3dvl/xsp_winsys.h1
-rw-r--r--src/libXvMC/context.c5
4 files changed, 26 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/g3dvl/vl_context.c b/src/gallium/state_trackers/g3dvl/vl_context.c
index 1668ad1651..3d4ca7cf4e 100644
--- a/src/gallium/state_trackers/g3dvl/vl_context.c
+++ b/src/gallium/state_trackers/g3dvl/vl_context.c
@@ -2208,8 +2208,6 @@ int vlDestroyContext(struct VL_CONTEXT *context)
vlDestroy(context);
- context->pipe->destroy(context->pipe);
-
free(context);
return 0;
diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.c b/src/gallium/winsys/g3dvl/xsp_winsys.c
index 7c5c592fc7..c660c6e018 100644
--- a/src/gallium/winsys/g3dvl/xsp_winsys.c
+++ b/src/gallium/winsys/g3dvl/xsp_winsys.c
@@ -224,8 +224,8 @@ static const char* xsp_get_name(struct pipe_winsys *pws)
struct pipe_context* create_pipe_context(Display *display)
{
struct xsp_pipe_winsys *xsp_winsys;
- struct pipe_screen *p_screen;
- struct pipe_context *p_context;
+ struct pipe_screen *screen;
+ struct pipe_context *pipe;
assert(display);
@@ -269,9 +269,25 @@ struct pipe_context* create_pipe_context(Display *display)
XDestroyImage(template);
}
- p_screen = softpipe_create_screen((struct pipe_winsys*)xsp_winsys);
- p_context = softpipe_create(p_screen, (struct pipe_winsys*)xsp_winsys, NULL);
+ screen = softpipe_create_screen((struct pipe_winsys*)xsp_winsys);
+ pipe = softpipe_create(screen, (struct pipe_winsys*)xsp_winsys, NULL);
- return p_context;
+ return pipe;
+}
+
+int destroy_pipe_context(struct pipe_context *pipe)
+{
+ struct pipe_screen *screen;
+ struct pipe_winsys *winsys;
+
+ assert(pipe);
+
+ screen = pipe->screen;
+ winsys = pipe->winsys;
+ pipe->destroy(pipe);
+ screen->destroy(screen);
+ free(winsys);
+
+ return 0;
}
diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.h b/src/gallium/winsys/g3dvl/xsp_winsys.h
index 47a6ac6e25..cb163dc24d 100644
--- a/src/gallium/winsys/g3dvl/xsp_winsys.h
+++ b/src/gallium/winsys/g3dvl/xsp_winsys.h
@@ -6,6 +6,7 @@
struct pipe_context;
struct pipe_context* create_pipe_context(Display *display);
+int destroy_pipe_context(struct pipe_context *pipe);
#endif
diff --git a/src/libXvMC/context.c b/src/libXvMC/context.c
index c835a6acf7..e559002577 100644
--- a/src/libXvMC/context.c
+++ b/src/libXvMC/context.c
@@ -136,7 +136,8 @@ Status XvMCCreateContext(Display *display, XvPortID port, int surface_type_id, i
Status XvMCDestroyContext(Display *display, XvMCContext *context)
{
- struct VL_CONTEXT *vl_ctx;
+ struct VL_CONTEXT *vl_ctx;
+ struct pipe_context *pipe;
assert(display);
@@ -147,7 +148,9 @@ Status XvMCDestroyContext(Display *display, XvMCContext *context)
assert(display == vl_ctx->display);
+ pipe = vl_ctx->pipe;
vlDestroyContext(vl_ctx);
+ destroy_pipe_context(pipe);
return Success;
}