Re: [PATCH v2 1/2] [PATCH v2 1/2] src: Fix issues reported by cppcheck static analysis tool

RAVI NANJUNDAPPA <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <15621916.604721408625258742.JavaMail.weblogic@epv6ml05>
Messed up with the subject tag of the patch. Submitted the corrected version.
Please ignore this patch. 

Thanks and Best Regards, 
N Ravi

------- Original Message -------
Sender : RAVI NANJUNDAPPA<[email protected]> Technical Lead/SRI-Bangalore-TZN/Samsung Electronics
Date : Aug 21, 2014 17:29 (GMT+05:30)
Title : [PATCH v2 1/2] [PATCH v2 1/2] src: Fix issues 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 
Reviewed-by: Chris Wilson 
---
src/skia/cairo-skia-surface.cpp |    4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/skia/cairo-skia-surface.cpp b/src/skia/cairo-skia-surface.cpp
index 9b16bd2..834a2f1 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,
-- 
1.7.9.5
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.