From 2212c214f1890091c102d4cb3c69ec2df2132322 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 3 Jul 2008 10:12:00 -0600 Subject: [PATCH] gallium: fix surface memleak in bitmap code Found w/ tunnel2.c demo. --- src/mesa/state_tracker/st_cb_bitmap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index f3bc3b85841..de86832342c 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -541,6 +541,9 @@ reset_cache(struct st_context *st) cache->ymin = 1000000; cache->ymax = -1000000; + if (cache->surf) + screen->tex_surface_release(screen, &cache->surf); + assert(!cache->texture); /* allocate a new texture */ @@ -588,6 +591,8 @@ st_flush_bitmap_cache(struct st_context *st) * So unmap and release the texture surface before drawing. */ screen->surface_unmap(screen, cache->surf); + cache->buffer = NULL; + screen->tex_surface_release(screen, &cache->surf); draw_bitmap_quad(st->ctx, -- 2.30.2