Check for visual==NULL in dmxBECreateColormap() before calling XCreateColormap()
to prevent potential segfault.
This commit is contained in:
parent
945b7c6394
commit
f7c1d94241
|
@ -40,6 +40,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dmx.h"
|
#include "dmx.h"
|
||||||
|
#include "dmxlog.h"
|
||||||
#include "dmxsync.h"
|
#include "dmxsync.h"
|
||||||
#include "dmxcmap.h"
|
#include "dmxcmap.h"
|
||||||
#include "dmxvisual.h"
|
#include "dmxvisual.h"
|
||||||
|
@ -83,12 +84,18 @@ Bool dmxBECreateColormap(ColormapPtr pColormap)
|
||||||
VisualPtr pVisual = pColormap->pVisual;
|
VisualPtr pVisual = pColormap->pVisual;
|
||||||
Visual *visual = dmxLookupVisual(pScreen, pVisual);
|
Visual *visual = dmxLookupVisual(pScreen, pVisual);
|
||||||
|
|
||||||
pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
|
if (visual) {
|
||||||
dmxScreen->scrnWin,
|
pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
|
||||||
visual,
|
dmxScreen->scrnWin,
|
||||||
(pVisual->class & DynamicClass ?
|
visual,
|
||||||
AllocAll : AllocNone));
|
(pVisual->class & DynamicClass ?
|
||||||
return (pCmapPriv->cmap != 0);
|
AllocAll : AllocNone));
|
||||||
|
return (pCmapPriv->cmap != 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dmxLog(dmxWarning, "dmxBECreateColormap: No visual found\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create colormap on back-end server associated with \a pColormap's
|
/** Create colormap on back-end server associated with \a pColormap's
|
||||||
|
|
Loading…
Reference in New Issue