summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2012-06-19 00:28:59 +0200
committerBen Skeggs <bskeggs@redhat.com>2012-06-19 09:59:54 +1000
commit794141f22179a09ba6b2a094ba72316c298fee8b (patch)
tree00a361c2594fb808561ce4f83873ccd913187e9c
parent661d0cf42219a063f8faa0518f3490ddd38209ff (diff)
exa: fix various issues in transfer bo handling
Thanks to "Christoph Bumiller <e0425955@student.tuwien.ac.at>" for hinting at the cause of the memory leak. Signed-off-by: Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--src/nouveau_exa.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nouveau_exa.c b/src/nouveau_exa.c
index 55dce99..9b6b1f3 100644
--- a/src/nouveau_exa.c
+++ b/src/nouveau_exa.c
@@ -175,20 +175,24 @@ nouveau_exa_scratch(NVPtr pNv, int size, struct nouveau_bo **pbo, int *off)
ret = nouveau_bo_new(pNv->dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
0, NOUVEAU_ALIGN(size, 1 * 1024 * 1024),
NULL, &bo);
- if (ret == 0)
- ret = nouveau_bo_map(bo, NOUVEAU_BO_RDWR, pNv->client);
if (ret != 0)
return ret;
+ ret = nouveau_bo_map(bo, NOUVEAU_BO_RDWR, pNv->client);
+ if (ret != 0) {
+ nouveau_bo_ref(NULL, &bo);
+ return ret;
+ }
+
nouveau_bo_ref(bo, &pNv->transfer);
+ nouveau_bo_ref(NULL, &bo);
pNv->transfer_offset = 0;
}
*off = pNv->transfer_offset;
*pbo = pNv->transfer;
- pNv->transfer_offset += size + 0xff;
- pNv->transfer_offset &= ~0xff;
+ pNv->transfer_offset += size;
return 0;
}