Attached updated patch.

Tom

________________________________________
From: Michel Dänzer <[email protected]>
Sent: Monday, April 11, 2016 03:22
To: StDenis, Tom
Cc: [email protected]
Subject: Re: [PATCH] amdgpu/dri3: Check for NULL from calloc call

On 09.04.2016 00:42, StDenis, Tom wrote:
> Simple check for NULL.

Please make the code match the radeon code. My bad for not doing so in
the first place.


--
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
From f41378a30fa32d3299d2d015e83e8220dc9828be Mon Sep 17 00:00:00 2001
From: Tom St Denis <[email protected]>
Date: Tue, 12 Apr 2016 08:48:33 -0400
Subject: [PATCH] dri3: Return NULL from amdgpu_dri3_pixmap_from_fd if calloc
 fails.

Signed-off-by: Tom St Denis <[email protected]>
---
 src/amdgpu_dri3.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/amdgpu_dri3.c b/src/amdgpu_dri3.c
index 068659903169..f87c014eb45c 100644
--- a/src/amdgpu_dri3.c
+++ b/src/amdgpu_dri3.c
@@ -138,8 +138,13 @@ static PixmapPtr amdgpu_dri3_pixmap_from_fd(ScreenPtr screen,
 		if (pixmap) {
 			struct amdgpu_pixmap *priv = calloc(1, sizeof(*priv));
 
-			amdgpu_set_pixmap_private(pixmap, priv);
-			return pixmap;
+			if (priv) {
+				amdgpu_set_pixmap_private(pixmap, priv);
+				return pixmap;
+			}
+
+			screen->DestroyPixmap(pixmap);
+			return NULL;
 		}
 	}
 #endif
-- 
2.8.1

_______________________________________________
xorg-driver-ati mailing list
[email protected]
https://lists.x.org/mailman/listinfo/xorg-driver-ati

Reply via email to