devilhorns pushed a commit to branch master.

commit 1ea718c28385fbcb2c619f3bbfd301fe7d83e4b2
Author: Chris Michael <[email protected]>
Date:   Mon Jul 8 08:38:54 2013 +0100

    Fix memleak reported by Coverity.
    
    NB: Fixes Coverity CID1039654
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/modules/evas/engines/gl_common/evas_gl_polygon.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_polygon.c 
b/src/modules/evas/engines/gl_common/evas_gl_polygon.c
index 536d2fc..f143d4c 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_polygon.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_polygon.c
@@ -70,10 +70,16 @@ evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, 
int y)
 {
    Evas_GL_Polygon_Point *pt;
 
-   if (!poly) poly = calloc(1, sizeof(Evas_GL_Polygon));
-   if (!poly) return NULL;
    pt = calloc(1, sizeof(Evas_GL_Polygon_Point));
    if (!pt) return NULL;
+
+   if (!poly) poly = calloc(1, sizeof(Evas_GL_Polygon));
+   if (!poly)
+     {
+        free(pt);
+        return NULL;
+     }
+
    pt->x = x;
    pt->y = y;
    poly->points = eina_list_append(poly->points, pt);

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to