nv50: plug memory leak in miptree creation/destruction
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 4 Dec 2009 22:16:32 +0000 (23:16 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 12 Dec 2009 15:38:59 +0000 (16:38 +0100)
Keeping this dynamically allocated for texture arrays.
Since we don't use it to store zslice offsets anymore
it's either 1 or 6 integers (cube) ...

src/gallium/drivers/nv50/nv50_miptree.c

index 40ee6659993b566439eb62d1c3ecda3eeb3e0669..795db5872df8783f412688c898ef4b4770ef5c9b 100644 (file)
@@ -130,6 +130,8 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
                                  mt->level[0].tile_mode, tile_flags,
                                  &mt->base.bo);
        if (ret) {
+               for (l = 0; l < pt->last_level; ++l)
+                       FREE(mt->level[l].image_offset);
                FREE(mt);
                return NULL;
        }
@@ -169,6 +171,10 @@ static void
 nv50_miptree_destroy(struct pipe_texture *pt)
 {
        struct nv50_miptree *mt = nv50_miptree(pt);
+       unsigned l;
+
+       for (l = 0; l < pt->last_level; ++l)
+               FREE(mt->level[l].image_offset);
 
        nouveau_bo_ref(NULL, &mt->base.bo);
        FREE(mt);