summaryrefslogtreecommitdiff
path: root/dix/privates.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2005-09-05 07:40:50 +0000
committerDaniel Stone <daniel@fooishbar.org>2005-09-05 07:40:50 +0000
commit5c5c51fa6da03f19831632a092761a1e4bcf653b (patch)
treefbbff9ebaeab589115da61eb8e66b0397faa98d2 /dix/privates.c
parent691669c0121494df90c8523f7d17e01ba0b14a57 (diff)
Initialise private arrays with calloc, rather than standard malloc.
(Benjamin Herrenschmidt)
Diffstat (limited to 'dix/privates.c')
-rw-r--r--dix/privates.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/dix/privates.c b/dix/privates.c
index 933810517..1e04a7b22 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -347,10 +347,13 @@ AllocateColormapPrivateIndex (InitCmapPrivFunc initPrivFunc)
{
privs = (DevUnion *) xrealloc (pColormap->devPrivates,
colormapPrivateCount * sizeof(DevUnion));
-
+ if (!privs) {
+ colormapPrivateCount--;
+ return -1;
+ }
+ bzero(&privs[index], sizeof(DevUnion));
pColormap->devPrivates = privs;
-
- if (!privs || !(*initPrivFunc)(pColormap,index))
+ if (!(*initPrivFunc)(pColormap,index))
{
colormapPrivateCount--;
return -1;