gallium/u_transfer_helper: Don't leak a reference to the resource.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 28 Jun 2019 00:00:46 +0000 (17:00 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 28 Jun 2019 18:25:56 +0000 (11:25 -0700)
We pipe_resource_reference when handling transfers in map, we need to
do a corresponding unreference in unmap.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/auxiliary/util/u_transfer_helper.c

index b7bd43f..033a49b 100644 (file)
@@ -511,6 +511,8 @@ u_transfer_helper_transfer_unmap(struct pipe_context *pctx,
             helper->vtbl->transfer_unmap(pctx, trans->trans2);
       }
 
+      pipe_resource_reference(&ptrans->resource, NULL);
+
       free(trans->staging);
       free(trans);
    } else {