From: Hermet Park Date: Tue, 6 Dec 2016 10:31:41 +0000 (+0900) Subject: ector gl: return the function as soon as possible. X-Git-Tag: accepted/tizen/common/20170102.152350~115 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5049e531accc3b7f4b608ca74d4f86252d40c524;p=platform%2Fupstream%2Fefl.git ector gl: return the function as soon as possible. This resolves a memory leak(new_pts) in an exceptional case. Change-Id: Ib3884330ee325364cb2acc73ca1a86585781d934 --- diff --git a/src/lib/ector/gl/ector_renderer_gl_shape.c b/src/lib/ector/gl/ector_renderer_gl_shape.c index ac06ece..dd959b1 100644 --- a/src/lib/ector/gl/ector_renderer_gl_shape.c +++ b/src/lib/ector/gl/ector_renderer_gl_shape.c @@ -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)