ector gl: return the function as soon as possible.
authorHermet Park <hermet@hermet.pe.kr>
Tue, 6 Dec 2016 10:31:41 +0000 (19:31 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 2 Jan 2017 07:23:58 +0000 (16:23 +0900)
This resolves a memory leak(new_pts) in an exceptional case.

Change-Id: Ib3884330ee325364cb2acc73ca1a86585781d934

src/lib/ector/gl/ector_renderer_gl_shape.c

index ac06ece..dd959b1 100644 (file)
@@ -78,10 +78,11 @@ _ector_renderer_gl_shape_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED,
 
    eo_do(obj, efl_gfx_shape_path_get(&cmds, &pts));
    eo_do(obj, efl_gfx_shape_path_length_get(&cmd_count, &pt_count));
+   if (!cmd_count) return EINA_FALSE;
+
    new_pts =  malloc(sizeof(double) * pt_count);
    memcpy(new_pts, pts, sizeof(double) * pt_count);
    _shape_transform(new_pts, pt_count, pd->base->m);
-   if (!cmd_count) return EINA_FALSE;
 
    eo_do(pd->surface, ector_gl_surface_offset(pd->base->origin.x, pd->base->origin.y));
    if (pd->base->color.a > 0)