Check pixmap allocation return value when creating glyphs
The driver may decide that the pixmap is too large or something and fail to allocate a pixmap; not checking would lead to a segfault. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
parent
03f7e92a6c
commit
87ea5760f8
|
@ -1140,6 +1140,12 @@ ProcRenderAddGlyphs (ClientPtr client)
|
||||||
width, height, depth,
|
width, height, depth,
|
||||||
CREATE_PIXMAP_USAGE_GLYPH_PICTURE);
|
CREATE_PIXMAP_USAGE_GLYPH_PICTURE);
|
||||||
|
|
||||||
|
if (!pDstPix)
|
||||||
|
{
|
||||||
|
err = BadAlloc;
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
|
||||||
GlyphPicture (glyph)[screen] = pDst =
|
GlyphPicture (glyph)[screen] = pDst =
|
||||||
CreatePicture (0, &pDstPix->drawable,
|
CreatePicture (0, &pDstPix->drawable,
|
||||||
glyphSet->format,
|
glyphSet->format,
|
||||||
|
@ -1149,6 +1155,7 @@ ProcRenderAddGlyphs (ClientPtr client)
|
||||||
/* The picture takes a reference to the pixmap, so we
|
/* The picture takes a reference to the pixmap, so we
|
||||||
drop ours. */
|
drop ours. */
|
||||||
(pScreen->DestroyPixmap) (pDstPix);
|
(pScreen->DestroyPixmap) (pDstPix);
|
||||||
|
pDstPix = NULL;
|
||||||
|
|
||||||
if (! pDst)
|
if (! pDst)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue