summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom St Denis <tom.stdenis@amd.com>2016-04-12 08:48:33 -0400
committerMichel Dänzer <michel.daenzer@amd.com>2016-04-13 18:18:16 +0900
commitb93006714b8de972060492cfa311320921a73773 (patch)
treede610c28c34416c6abffa21fb6d844db60e4c094
parenta0bbb373f902e0ffc14570c85faec7e44134f62e (diff)
dri3: Return NULL from amdgpu_dri3_pixmap_from_fd if calloc fails.
Signed-off-by: Tom St Denis <tom.stdenis@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
-rw-r--r--src/amdgpu_dri3.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/amdgpu_dri3.c b/src/amdgpu_dri3.c
index 0686599..f87c014 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