summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-05-10 11:46:25 -0700
committerKeith Packard <keithp@keithp.com>2010-05-15 19:51:05 -0700
commit87ea5760f86eb60840e6e2c10012915952df5377 (patch)
tree6e8dccce36cb7557d3c5892190e67a5f9465df06 /render
parent03f7e92a6cbfe58db08ce840283f9809695c70e7 (diff)
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>
Diffstat (limited to 'render')
-rw-r--r--render/render.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/render/render.c b/render/render.c
index bba1ce1e6..9aabcfb20 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1140,6 +1140,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,
@@ -1149,6 +1155,7 @@ ProcRenderAddGlyphs (ClientPtr client)
/* The picture takes a reference to the pixmap, so we
drop ours. */
(pScreen->DestroyPixmap) (pDstPix);
+ pDstPix = NULL;
if (! pDst)
{