summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-24 18:33:14 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-24 18:54:07 +0000
commit22bab3cd7d0b2bcedfdd86f198d1ed9a21dd82aa (patch)
treea0edfec2545703869ece6351a4b39ad85d8d20f4
parent4aef9e6f50cb96c57b7ba345a18e55c97d788192 (diff)
sna: Handle malloc failures when downsampling
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 56d0014d..af817351 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -734,9 +734,19 @@ static int sna_render_picture_downsample(struct sna *sna,
tmp_dst = CreatePicture(0, &tmp->drawable, format, 0, NULL,
serverClient, &error);
+ if (!tmp_dst) {
+ screen->DestroyPixmap(tmp);
+ goto fixup;
+ }
tmp_src = CreatePicture(0, &pixmap->drawable, format, 0, NULL,
serverClient, &error);
+ if (!tmp_src) {
+ FreePicture(tmp_dst, 0);
+ screen->DestroyPixmap(tmp);
+ goto fixup;
+ }
+
tmp_src->repeat = true;
tmp_src->repeatType = RepeatPad;
tmp_src->filter = PictFilterBilinear;