Mesa (master): nouveau: fix buffer object leak

Ben Skeggs darktama at kemper.freedesktop.org
Tue Oct 6 03:32:49 UTC 2009


Module: Mesa
Branch: master
Commit: 4911443d364e38bf93915cf9587f5cf8791cb30d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4911443d364e38bf93915cf9587f5cf8791cb30d

Author: Ben Skeggs <bskeggs at redhat.com>
Date:   Tue Oct  6 13:18:09 2009 +1000

nouveau: fix buffer object leak

Very apparent with resizing windows on DRI2.

---

 .../winsys/drm/nouveau/drm/nouveau_drm_api.c       |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
index 8b53183..f512c0e 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
+++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
@@ -197,6 +197,7 @@ nouveau_drm_pt_from_name(struct drm_api *api, struct pipe_screen *pscreen,
 			 unsigned stride, unsigned handle)
 {
 	struct nouveau_device *dev = nouveau_screen(pscreen)->device;
+	struct pipe_texture *pt;
 	struct pipe_buffer *pb;
 	int ret;
 
@@ -218,7 +219,9 @@ nouveau_drm_pt_from_name(struct drm_api *api, struct pipe_screen *pscreen,
 	pb->usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE |
 		    PIPE_BUFFER_USAGE_CPU_READ_WRITE;
 	pb->size = nouveau_bo(pb)->size;
-	return pscreen->texture_blanket(pscreen, templ, &stride, pb);
+	pt = pscreen->texture_blanket(pscreen, templ, &stride, pb);
+	pipe_buffer_reference(&pb, NULL);
+	return pt;
 }
 
 static boolean




More information about the mesa-commit mailing list