diff options
author | Daniel Stone <daniel@fooishbar.org> | 2005-09-05 07:40:50 +0000 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2005-09-05 07:40:50 +0000 |
commit | 5c5c51fa6da03f19831632a092761a1e4bcf653b (patch) | |
tree | fbbff9ebaeab589115da61eb8e66b0397faa98d2 /dix/privates.c | |
parent | 691669c0121494df90c8523f7d17e01ba0b14a57 (diff) |
Initialise private arrays with calloc, rather than standard malloc.
(Benjamin Herrenschmidt)
Diffstat (limited to 'dix/privates.c')
-rw-r--r-- | dix/privates.c | 9 |
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; |