nv40: a couple of memory leaks
authorBen Skeggs <skeggsb@gmail.com>
Fri, 30 May 2008 01:04:55 +0000 (11:04 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Fri, 30 May 2008 01:04:55 +0000 (11:04 +1000)
src/gallium/drivers/nv40/nv40_state_viewport.c
src/gallium/drivers/nv40/nv40_vertprog.c

index 1b6248e5b8e0c07740194acc0bb5b2606d885749..869a55b40536d9d59718f9f970ba6a08e1e75657 100644 (file)
@@ -3,8 +3,8 @@
 static boolean
 nv40_state_viewport_validate(struct nv40_context *nv40)
 {
-       struct nouveau_stateobj *so = so_new(11, 0);
        struct pipe_viewport_state *vpt = &nv40->viewport;
+       struct nouveau_stateobj *so;
        unsigned bypass;
 
        if (nv40->render_mode == HW && !nv40->rasterizer->pipe.bypass_clipping)
@@ -18,6 +18,7 @@ nv40_state_viewport_validate(struct nv40_context *nv40)
                return FALSE;
        nv40->state.viewport_bypass = bypass;
 
+       so = so_new(11, 0);
        if (!bypass) {
                so_method(so, nv40->screen->curie,
                          NV40TCL_VIEWPORT_TRANSLATE_X, 8);
index e10250528e2a406e0631139e40981be009821b4a..eb14869bfe04506ec44c6a3163e5675212947719 100644 (file)
@@ -843,6 +843,12 @@ nv40_vertprog_translate(struct nv40_context *nv40,
        vp->translated = TRUE;
 out_err:
        tgsi_parse_free(&parse);
+       if (vpc->r_temp)
+               FREE(vpc->r_temp); 
+       if (vpc->r_address)
+               FREE(vpc->r_address); 
+       if (vpc->imm)   
+               FREE(vpc->imm); 
        FREE(vpc);
 }