From: Michel Dänzer <michel.daen...@amd.com>

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

Reported-by: Qiang Yu <qiang...@amd.com>
(Ported from amdgpu commit 7f7f9825caf3983902491da27c16d14cd8bf9b7d)

Signed-off-by: Michel Dänzer <michel.daen...@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

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to