nv50: fix 2 off by one memory leaks (nv50_miptree_level->image_offset)
authorMarcin Slusarz <marcin.slusarz@gmail.com>
Tue, 12 Jan 2010 16:39:23 +0000 (17:39 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Tue, 12 Jan 2010 16:39:23 +0000 (17:39 +0100)
src/gallium/drivers/nv50/nv50_miptree.c

index 3f1edf0a13970cba730556e2b3eee69f97d44239..cecb1efc9008fcf7a06c87bd0cbdc129bab64c55 100644 (file)
@@ -145,7 +145,7 @@ 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)
+               for (l = 0; l <= pt->last_level; ++l)
                        FREE(mt->level[l].image_offset);
                FREE(mt);
                return NULL;
@@ -188,7 +188,7 @@ nv50_miptree_destroy(struct pipe_texture *pt)
        struct nv50_miptree *mt = nv50_miptree(pt);
        unsigned l;
 
-       for (l = 0; l < pt->last_level; ++l)
+       for (l = 0; l <= pt->last_level; ++l)
                FREE(mt->level[l].image_offset);
 
        nouveau_bo_ref(NULL, &mt->base.bo);