nouveau/exa: unref bo if map failed
PATCH 1/2 nouveau/exa: unref bo if map failed
Signed-off-by Maarten Maathuis <[email protected]>
--- src/nouveau_exa.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
src/nouveau_exa.c +6 -2
@@ -175,11 +175,15 @@ 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); pNv->transfer_offset =0 ; }
Signature · 1 line
1.7.8.6
PATCH 2/2 nouveau/exa: Fix transfer bo memory leak
In reply to a message not in the archiveThanks to "Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>" for hinting at the cause of the problem.
Signed-off-by Maarten Maathuis <[email protected]>
--- src/nouveau_exa.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
src/nouveau_exa.c +2 -0
@@ -185,6 +185,8 @@ nouveau_exa_scratch(NVPtr pNv, int size, struct nouveau_bo **pbo, int *off) }nouveau_bo_ref (bo, &pNv->transfer); +/* Lower the refcount of the bo back to 1, otherwise it will never be freed. */ +nouveau_bo_ref (NULL , &bo); pNv->transfer_offset =0 ; }
Signature · 1 line
1.7.8.6