[PATCH 2/7] Check pixmap allocation return value when creating glyphs

Keith Packard keithp at keithp.com
Wed May 12 14:45:06 PDT 2010


---
 render/render.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/render/render.c b/render/render.c
index c9d3e8e..a3e96c0 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1145,6 +1145,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,
@@ -1154,6 +1160,7 @@ ProcRenderAddGlyphs (ClientPtr client)
 		/* The picture takes a reference to the pixmap, so we
 		   drop ours. */
 		(pScreen->DestroyPixmap) (pDstPix);
+		pDstPix = NULL;
 
 		if (! pDst)
 		{
-- 
1.7.1



More information about the xorg-devel mailing list