u_vbuf: fix index buffer leak
authorChia-I Wu <olvaffe@gmail.com>
Tue, 4 Jun 2013 08:39:07 +0000 (16:39 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Fri, 7 Jun 2013 11:33:30 +0000 (19:33 +0800)
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
src/gallium/auxiliary/util/u_vbuf.c

index 244b04d2a42f62c53cae6470dfca7f5bb512a897..5936f74a0390acbbb8a060307a01ca2b3d172502 100644 (file)
@@ -307,6 +307,9 @@ void u_vbuf_destroy(struct u_vbuf *mgr)
    unsigned num_vb = screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
                                               PIPE_SHADER_CAP_MAX_INPUTS);
 
+   mgr->pipe->set_index_buffer(mgr->pipe, NULL);
+   pipe_resource_reference(&mgr->index_buffer.buffer, NULL);
+
    mgr->pipe->set_vertex_buffers(mgr->pipe, 0, num_vb, NULL);
 
    for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {