Ralovich, Kristóf wrote:
> This patch is at
> http://cgit.freedesktop.org/~tade/mesa/commit/?h=xcb-integration&id=18deb0897ede0d1406bcfc7419b12654ceddf6af
> .
>
> Kristof
>
>
>>From 18deb0897ede0d1406bcfc7419b12654ceddf6af Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?Ralovich,=20Krist=C3=B3f?= <[EMAIL PROTECTED]>
> Date: Tue, 19 Aug 2008 14:48:34 +0200
> Subject: [PATCH] Plugging a leak by freeing vertex array state.
>
> ---
> src/glx/x11/glxcmds.c | 2 ++
> src/glx/x11/indirect_vertex_array.c | 24 ++++++++++++++++++++++++
> 2 files changed, 26 insertions(+), 0 deletions(-)
>
> diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
> index d59bbd2..a4ee260 100644
> --- a/src/glx/x11/glxcmds.c
> +++ b/src/glx/x11/glxcmds.c
> @@ -539,6 +539,8 @@ DestroyContext(Display *dpy, GLXContext gc)
> }
> #endif
>
> + __glXFreeVertexArrayState(gc);
> +
> if (gc->currentDpy) {
> /* Have to free later cuz it's in use now */
> __glXUnlock();
> diff --git a/src/glx/x11/indirect_vertex_array.c
> b/src/glx/x11/indirect_vertex_array.c
> index 15e3ece..8c22f0a 100644
> --- a/src/glx/x11/indirect_vertex_array.c
> +++ b/src/glx/x11/indirect_vertex_array.c
> @@ -101,6 +101,30 @@ const GLuint __glXTypeSize_table[16] = {
> };
>
>
> +/**
> + *
> + */
> +void
> +__glXFreeVertexArrayState( __GLXcontext * gc )
> +{
> + __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
No idea how mesa developers feel about casting void* to another pointer
type, but in C this cast is not necessary.
> + struct array_state_vector* arrays =
> + (struct array_state_vector*)state->array_state;
This is also not necessary since state->array_state is already of type
'struct array_state_vector *'.
> +
> + if (arrays) {
> + if (arrays->stack) {
> + free(arrays->stack);
> + arrays->stack = NULL;
> + }
> + if (arrays->arrays) {
> + free(arrays->arrays);
> + arrays->arrays = NULL;
> + }
> + free(arrays);
> + arrays = NULL;
> + }
> +}
> +
>
> /**
> * Initialize vertex array state of a GLX context.
> --
> 1.5.6.3
tom
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev