summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-12-17 17:17:34 +0900
committerHermet Park <hermetpark@gmail.com>2019-12-17 17:19:21 +0900
commitbe8d1afd1e4ec0fa920705a053d4e6aba2e659b1 (patch)
tree96209e67e0e1bbd8cc652c954f7d0ccf789c788e
parent68e9bf9c14b58c682d5151f73b21f920905bd320 (diff)
evas mapping: fix memory leak.
These two dynamically allocated properties were not freed. free them when cow data is reset.
-rw-r--r--src/lib/evas/canvas/efl_gfx_mapping.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/evas/canvas/efl_gfx_mapping.c b/src/lib/evas/canvas/efl_gfx_mapping.c
index cebab06fb2..b05239b369 100644
--- a/src/lib/evas/canvas/efl_gfx_mapping.c
+++ b/src/lib/evas/canvas/efl_gfx_mapping.c
@@ -138,7 +138,7 @@ static const Gfx_Map gfx_mapping_cow_default = {
138#define PIVOT_REF(_pivot) (_pivot ? efl_xref((Eo *) _pivot, eo_obj) : NULL) 138#define PIVOT_REF(_pivot) (_pivot ? efl_xref((Eo *) _pivot, eo_obj) : NULL)
139#define PIVOT_UNREF(_pivot) (_pivot ? efl_xunref(_pivot, eo_obj) : NULL) 139#define PIVOT_UNREF(_pivot) (_pivot ? efl_xunref(_pivot, eo_obj) : NULL)
140 140
141static inline void _map_ops_clean(Eo *eo_obj, Efl_Gfx_Mapping_Data *pd); 141static inline void _map_clean(Eo *eo_obj, Efl_Gfx_Mapping_Data *pd);
142 142
143// ---------------------------------------------------------------------------- 143// ----------------------------------------------------------------------------
144 144
@@ -174,8 +174,7 @@ _efl_gfx_mapping_efl_object_destructor(Eo *eo_obj, Efl_Gfx_Mapping_Data *pd)
174{ 174{
175 if (pd->cow) 175 if (pd->cow)
176 { 176 {
177 _map_ops_clean(eo_obj, pd); 177 _map_clean(eo_obj, pd);
178 free(pd->cow->points);
179 eina_cow_free(gfx_mapping_cow, (const Eina_Cow_Data **) &pd->cow); 178 eina_cow_free(gfx_mapping_cow, (const Eina_Cow_Data **) &pd->cow);
180 } 179 }
181 efl_destructor(efl_super(eo_obj, MY_CLASS)); 180 efl_destructor(efl_super(eo_obj, MY_CLASS));
@@ -365,7 +364,7 @@ _map_calc(const Eo *eo_obj, Evas_Object_Protected_Data *obj, Efl_Gfx_Mapping_Dat
365 if (!op->pivot.pivot) 364 if (!op->pivot.pivot)
366 { 365 {
367 EINA_SAFETY_ERROR("safety check failed: op->pivot.pivot == NULL"); 366 EINA_SAFETY_ERROR("safety check failed: op->pivot.pivot == NULL");
368 if (map_alloc) free(m); 367 if (map_alloc) evas_map_free(m);
369 return NULL; 368 return NULL;
370 } 369 }
371 370
@@ -471,8 +470,10 @@ _efl_gfx_mapping_update(Eo *eo_obj)
471} 470}
472 471
473static inline void 472static inline void
474_map_ops_clean(Eo *eo_obj, Efl_Gfx_Mapping_Data *pd) 473_map_clean(Eo *eo_obj, Efl_Gfx_Mapping_Data *pd)
475{ 474{
475 free(pd->cow->points);
476 if (pd->cow->map) evas_map_free(pd->cow->map);
476 if (pd->cow->ops) 477 if (pd->cow->ops)
477 { 478 {
478 Gfx_Map_Pivot *pivot; 479 Gfx_Map_Pivot *pivot;
@@ -514,7 +515,7 @@ _efl_gfx_mapping_mapping_reset(Eo *eo_obj, Efl_Gfx_Mapping_Data *pd)
514 515
515 alpha = pd->cow->alpha; 516 alpha = pd->cow->alpha;
516 smooth = pd->cow->smooth; 517 smooth = pd->cow->smooth;
517 _map_ops_clean(eo_obj, pd); 518 _map_clean(eo_obj, pd);
518 if (pd->cow->event_cbs) 519 if (pd->cow->event_cbs)
519 efl_event_callback_array_del(eo_obj, _geometry_changes(), obj); 520 efl_event_callback_array_del(eo_obj, _geometry_changes(), obj);
520 521