Initialise private arrays with calloc, rather than standard malloc.
(Benjamin Herrenschmidt)
This commit is contained in:
parent
691669c012
commit
5c5c51fa6d
|
@ -398,9 +398,8 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||||
pmap->devPrivates = NULL;
|
pmap->devPrivates = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pmap->devPrivates = (DevUnion *) xalloc (
|
pmap->devPrivates = (DevUnion *) xcalloc (
|
||||||
colormapPrivateCount * sizeof(DevUnion));
|
sizeof(DevUnion), colormapPrivateCount);
|
||||||
|
|
||||||
if (!pmap->devPrivates)
|
if (!pmap->devPrivates)
|
||||||
{
|
{
|
||||||
FreeResource (mid, RT_NONE);
|
FreeResource (mid, RT_NONE);
|
||||||
|
|
|
@ -347,10 +347,13 @@ AllocateColormapPrivateIndex (InitCmapPrivFunc initPrivFunc)
|
||||||
{
|
{
|
||||||
privs = (DevUnion *) xrealloc (pColormap->devPrivates,
|
privs = (DevUnion *) xrealloc (pColormap->devPrivates,
|
||||||
colormapPrivateCount * sizeof(DevUnion));
|
colormapPrivateCount * sizeof(DevUnion));
|
||||||
|
if (!privs) {
|
||||||
|
colormapPrivateCount--;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
bzero(&privs[index], sizeof(DevUnion));
|
||||||
pColormap->devPrivates = privs;
|
pColormap->devPrivates = privs;
|
||||||
|
if (!(*initPrivFunc)(pColormap,index))
|
||||||
if (!privs || !(*initPrivFunc)(pColormap,index))
|
|
||||||
{
|
{
|
||||||
colormapPrivateCount--;
|
colormapPrivateCount--;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue