summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Nanjundappa <nravi.n@samsung.com>2014-08-21 18:18:34 +0530
committerBryce Harrington <bryce@osg.samsung.com>2014-08-27 20:39:49 -0700
commit52c4f0f2dafcc6e087a9c3c6d00c582fc272c2c2 (patch)
treef86d1eec9afcd85797959fbeae40ebcd2bde67cf
parenta5f51588afd9d5629b03297eb29ff46350b6ba50 (diff)
downloadcairo-52c4f0f2dafcc6e087a9c3c6d00c582fc272c2c2.tar.gz
src: Fix memory issue reported by cppcheck static analysis tool
cppcheck analysis tool reports the following issues when run on the latest Cairo source. $ grep "(error)" cppcheck_error_log.txt [src/skia/cairo-skia-surface.cpp:245]: (error) Memory leak: surface $ The proposed changes fixes the above issues. Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/skia/cairo-skia-surface.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/skia/cairo-skia-surface.cpp b/src/skia/cairo-skia-surface.cpp
index 9b16bd2c0..834a2f13b 100644
--- a/src/skia/cairo-skia-surface.cpp
+++ b/src/skia/cairo-skia-surface.cpp
@@ -241,8 +241,10 @@ _cairo_skia_surface_create_internal (SkBitmap::Config config,
pixman_image = pixman_image_create_bits (pixman_format,
width, height,
(uint32_t *) data, stride);
- if (unlikely (pixman_image == NULL))
+ if (unlikely (pixman_image == NULL)) {
+ free (surface);
return (cairo_skia_surface_t *) _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
+ }
_cairo_surface_init (&surface->image.base,
&cairo_skia_surface_backend,