st/mesa: fix resource leak in try_pbo_readpixels
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 2 Jun 2016 20:48:52 +0000 (22:48 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 6 Jun 2016 19:42:27 +0000 (21:42 +0200)
Found by inspection after seeing
https://bugs.freedesktop.org/show_bug.cgi?id=96343

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_cb_readpixels.c

index 09450c9f41b05d4508a57f19d37e64632f992a4b..42ff73b069116eec8eeb8c9f9daf3ed2700a6688 100644 (file)
@@ -169,7 +169,7 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb,
       struct pipe_image_view image;
 
       memset(&image, 0, sizeof(image));
-      pipe_resource_reference(&image.resource, addr.buffer);
+      image.resource = addr.buffer;
       image.format = dst_format;
       image.access = PIPE_IMAGE_ACCESS_WRITE;
       image.u.buf.first_element = addr.first_element;