nouveau: fix buffer object leak
authorBen Skeggs <bskeggs@redhat.com>
Tue, 6 Oct 2009 03:18:09 +0000 (13:18 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 6 Oct 2009 03:31:43 +0000 (13:31 +1000)
Very apparent with resizing windows on DRI2.

src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c

index 8b531830f4fca9bea2315b66f798ec9326744790..f512c0e5f328dba0e802bd4c4c97e579c6c45ada 100644 (file)
@@ -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