From: Piotr Chludzinski
Date: Mon, 15 Mar 2021 09:53:15 +0000 (+0100)
Subject: efl_canvas_vg_shape: fix memory leak
X-Git-Tag: accepted/tizen/unified/20210330.111316~13
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F32%2F255232%2F5;p=platform%2Fupstream%2Fefl.git
efl_canvas_vg_shape: fix memory leak
Change-Id: I64e8b90956f55c993101689af01d54681417cc6d
Signed-off-by: Piotr Chludzinski
---
diff --git a/src/lib/evas/canvas/efl_canvas_vg_shape.c b/src/lib/evas/canvas/efl_canvas_vg_shape.c
index 216807b..95fdce7 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_shape.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_shape.c
@@ -552,6 +552,8 @@ _shape_interpolate(Evas_Vg_Shape *obj,
tvg_shape_get_path_coords(tvg_to, (const Tvg_Point**)&path_coords_to, &pts_count_to);
path_coords_dest = (Tvg_Point*)malloc(sizeof(Tvg_Point) * pts_count_from);
+ if (!path_coords_dest) return EINA_FALSE;
+
for (i = 0; i < pts_count_from; ++i)
{
path_coords_dest[i].x = _interpolate(path_coords_from[i].x, path_coords_to[i].x, pos_map);
@@ -560,6 +562,7 @@ _shape_interpolate(Evas_Vg_Shape *obj,
_shape_properties_interpolate(obj, from, to, pos_map);
tvg_shape_append_path(tvg_dest, path_commands_from, cmds_count_from, path_coords_dest, pts_count_from);
+ free(path_coords_dest);
return EINA_TRUE;
}
#endif