[PATCH xf86-video-ati 03/15] Free priv in amdgpu_set_pixmap_bo also if priv->bo == NULL
Michel Dänzer
michel at daenzer.net
Wed Sep 21 09:50:42 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>
(Ported from amdgpu commit 7f7f9825caf3983902491da27c16d14cd8bf9b7d)
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/radeon.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/radeon.h b/src/radeon.h
index c914a58..0bf6d37 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -691,11 +691,12 @@ static inline Bool radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo)
return TRUE;
if (priv) {
- if (priv->bo == bo)
- return TRUE;
+ if (priv->bo) {
+ if (priv->bo == bo)
+ return TRUE;
- if (priv->bo)
radeon_bo_unref(priv->bo);
+ }
if (!bo) {
free(priv);
--
2.9.3
More information about the amd-gfx
mailing list