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>
(cherry picked from commit 87ea5760f8)
This commit is contained in:
Keith Packard 2010-05-10 11:46:25 -07:00 committed by Peter Hutterer
parent e789c860a6
commit 4b7ff07db2

View file

@ -1159,6 +1159,12 @@ ProcRenderAddGlyphs (ClientPtr client)
width, height, depth,
CREATE_PIXMAP_USAGE_GLYPH_PICTURE);
if (!pDstPix)
{
err = BadAlloc;
goto bail;
}
GlyphPicture (glyph)[screen] = pDst =
CreatePicture (0, &pDstPix->drawable,
glyphSet->format,
@ -1168,6 +1174,7 @@ ProcRenderAddGlyphs (ClientPtr client)
/* The picture takes a reference to the pixmap, so we
drop ours. */
(pScreen->DestroyPixmap) (pDstPix);
pDstPix = NULL;
if (! pDst)
{