From 5947beb666390fdfdd2b59a78dd7bf761a662bc4 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 12 Jun 2018 11:27:51 +0900 Subject: [PATCH] evas vg: get rid of memory leak. alloc mem only if it didn't alloc'd yet. @fix --- src/lib/evas/canvas/efl_canvas_vg_object.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c index 87932c1..2ff4226 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_object.c +++ b/src/lib/evas/canvas/efl_canvas_vg_object.c @@ -164,8 +164,12 @@ _efl_canvas_vg_object_root_node_set(Eo *obj, Efl_Canvas_Vg_Object_Data *pd, Efl_ if (root_node) { - pd->user_entry = calloc(1, sizeof(User_Vg_Entry)); + if (!pd->user_entry) + pd->user_entry = malloc(sizeof(User_Vg_Entry)); + + pd->user_entry->w = pd->user_entry->h = 0; pd->user_entry->root = root_node; + // set the parent so that vg canvas can render it. efl_parent_set(pd->user_entry->root, pd->root); } -- 2.7.4