r300g: Fix memory leak in radeon_texture_from_shared_handle
authorNicolai Hähnle <nhaehnle@gmail.com>
Sat, 3 Oct 2009 15:56:51 +0000 (17:56 +0200)
committerNicolai Hähnle <nhaehnle@gmail.com>
Sat, 3 Oct 2009 16:07:34 +0000 (18:07 +0200)
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
src/gallium/winsys/drm/radeon/core/radeon_drm.c

index a4011db0b87df41785be89ce4de387af0a60723d..caab33de1ccc0879bd5af3fe53f0b392e55c3ace 100644 (file)
@@ -107,13 +107,18 @@ radeon_texture_from_shared_handle(struct drm_api *api,
                                   unsigned handle)
 {
     struct pipe_buffer *buffer;
+    struct pipe_texture *blanket;
 
     buffer = radeon_buffer_from_handle(api, screen, name, handle);
     if (!buffer) {
         return NULL;
     }
 
-    return screen->texture_blanket(screen, templ, &stride, buffer);
+    blanket = screen->texture_blanket(screen, templ, &stride, buffer);
+
+    pipe_buffer_reference(&buffer, NULL);
+
+    return blanket;
 }
 
 static boolean radeon_shared_handle_from_texture(struct drm_api *api,