Commit 5c5c51fa authored by Daniel Stone's avatar Daniel Stone

Initialise private arrays with calloc, rather than standard malloc.

    (Benjamin Herrenschmidt)
parent 691669c0
......@@ -398,9 +398,8 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
pmap->devPrivates = NULL;
else
{
pmap->devPrivates = (DevUnion *) xalloc (
colormapPrivateCount * sizeof(DevUnion));
pmap->devPrivates = (DevUnion *) xcalloc (
sizeof(DevUnion), colormapPrivateCount);
if (!pmap->devPrivates)
{
FreeResource (mid, RT_NONE);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment