[PATCH xf86-video-amdgpu 5/5] Free priv in amdgpu_set_pixmap_bo also if priv->bo == NULL

Michel Dänzer michel at daenzer.net
Wed Jun 15 10:00:50 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

Fixes memory leak when destroying pixmaps with priv->bo == NULL.

Reported-by: Qiang Yu <qiang.yu at amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_pixmap.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/amdgpu_pixmap.h b/src/amdgpu_pixmap.h
index 9c51067..a8de26a 100644
--- a/src/amdgpu_pixmap.h
+++ b/src/amdgpu_pixmap.h
@@ -63,10 +63,10 @@ static inline Bool amdgpu_set_pixmap_bo(PixmapPtr pPix, struct amdgpu_buffer *bo
 		return TRUE;
 
 	if (priv) {
-		if (priv->bo == bo)
-			return TRUE;
-
 		if (priv->bo) {
+			if (priv->bo == bo)
+				return TRUE;
+
 			amdgpu_bo_unref(&priv->bo);
 			priv->handle_valid = FALSE;
 		}
-- 
2.8.1



More information about the xorg-driver-ati mailing list