diff options
author | Younes Manton <younes.m@gmail.com> | 2008-07-19 16:22:56 -0400 |
---|---|---|
committer | Younes Manton <younes.m@gmail.com> | 2008-07-20 19:16:41 -0400 |
commit | c243573fafe8e83d4964535b201c499164d7c172 (patch) | |
tree | 41781847321e2a775b7d21f52a6587b37ee4f4ea /src/gallium/winsys/g3dvl | |
parent | 8878d8d4b35c9550632f5684bdc97f3958bf43c5 (diff) |
g3dvl: Fix some memory leaks in the winsys.
Diffstat (limited to 'src/gallium/winsys/g3dvl')
-rw-r--r-- | src/gallium/winsys/g3dvl/xsp_winsys.c | 26 | ||||
-rw-r--r-- | src/gallium/winsys/g3dvl/xsp_winsys.h | 1 |
2 files changed, 22 insertions, 5 deletions
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 |