From f62f4d53ef91ba05cc9456b1468cd1b24252454f Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Thu, 2 Aug 2012 18:07:07 +0800 Subject: [PATCH] glamor_glyphs: When dst arg point to a NULL buffer, dont't flush. This is a corner case, when we render glyphs via mask cache, and when we need to upload new glyphs cache, we need to flush both the mask and dest buffer. But we the dest arg may point to a NULL buffer at that time, we need to check it firstly. If the dest buffer is NULL. Then we don't need to flush both the dest and mask buffer. This commit fix a potential crash. Signed-off-by: Zhigang Gong --- glamor/glamor_glyphs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/glamor/glamor_glyphs.c b/glamor/glamor_glyphs.c index bab2c2465..f5499049a 100644 --- a/glamor/glamor_glyphs.c +++ b/glamor/glamor_glyphs.c @@ -1193,6 +1193,9 @@ glamor_glyphs_flush_mask(struct glyphs_flush_mask_arg *arg) static void glamor_glyphs_flush_dst(struct glyphs_flush_dst_arg * arg) { + if (!arg->buffer) + return; + if (mask_buffer.count > 0) { glamor_glyphs_flush_mask(&mask_arg); }