From 3c37477ebe2efd108d70b346bfbc6da84cff5e5f Mon Sep 17 00:00:00 2001 From: "tor%cs.brown.edu" Date: Tue, 21 Nov 2006 23:57:56 +0000 Subject: [PATCH] Bug 360122 - correct cairo_create error checking. Patch by amenzie@us.ibm.com, r=tor, sr=roc git-svn-id: svn://10.0.0.236/trunk@215599 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/svg/content/src/nsSVGPathElement.cpp | 3 ++- mozilla/layout/svg/base/src/nsSVGMaskFrame.cpp | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mozilla/content/svg/content/src/nsSVGPathElement.cpp b/mozilla/content/svg/content/src/nsSVGPathElement.cpp index 94b6b46765d..525a5992fd8 100644 --- a/mozilla/content/svg/content/src/nsSVGPathElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGPathElement.cpp @@ -480,7 +480,8 @@ nsSVGPathElement::GetFlattenedPath(nsIDOMSVGMatrix *aMatrix) return nsnull; cairo_t *ctx = cairo_create(dummySurface); - if (!ctx) { + if (cairo_status(ctx) != CAIRO_STATUS_SUCCESS) { + cairo_destroy(ctx); cairo_surface_destroy(dummySurface); return nsnull; } diff --git a/mozilla/layout/svg/base/src/nsSVGMaskFrame.cpp b/mozilla/layout/svg/base/src/nsSVGMaskFrame.cpp index 384a77761f4..253908cd874 100644 --- a/mozilla/layout/svg/base/src/nsSVGMaskFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGMaskFrame.cpp @@ -241,8 +241,12 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsISVGRendererCanvas* aCanvas, return nsnull; cairo_t *transferCtx = cairo_create(image); - if (!transferCtx) + if (cairo_status(transferCtx) != CAIRO_STATUS_SUCCESS) { + cairo_destroy(transferCtx); + cairo_surface_destroy(image); + cairo_pattern_destroy(pattern); return nsnull; + } cairo_set_source_surface(transferCtx, surface, 0, 0); cairo_paint(transferCtx);