summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-06-13 18:58:49 +0900
committerMichel Dänzer <michel@daenzer.net>2016-06-16 15:21:26 +0900
commit7f7f9825caf3983902491da27c16d14cd8bf9b7d (patch)
tree42c87111f761d986d24208b335301405692c6ad8
parent397aedafee437c125b8ac1feafb1c3b466842aeb (diff)
Free priv in amdgpu_set_pixmap_bo also if priv->bo == NULL
Fixes memory leak when destroying pixmaps with priv->bo == NULL. Reported-by: Qiang Yu <qiang.yu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/amdgpu_pixmap.h6
1 files 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;
}