summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-05-10 11:46:25 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2010-05-18 14:45:22 +1000
commit4b7ff07db28ea5302a1965496d1fd71a9d99780e (patch)
tree82a23ca142bdc382a21e8b7f73cddc35e2d5b378
parente789c860a682454fc86032e88b618f255409c33a (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> (cherry picked from commit 87ea5760f86eb60840e6e2c10012915952df5377)
-rw-r--r--render/render.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/render/render.c b/render/render.c
index 2d9e47a9c..afe4c92e7 100644
--- a/render/render.c
+++ b/render/render.c
@@ -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)
{