From 66b253bebf1d4c92188cff42f57548a0a1decdab Mon Sep 17 00:00:00 2001 From: MinJeong Kim Date: Tue, 5 Jul 2016 22:15:14 +0900 Subject: [PATCH] Fixed memory leak and invalid memory access Change-Id: I6a0fa8f1f56296e199ad386c32a53df23e2b3205 --- src/e_mod_effect.c | 4 ++-- src/e_mod_effect_rotation.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/e_mod_effect.c b/src/e_mod_effect.c index c4dffdd..8c969a9 100644 --- a/src/e_mod_effect.c +++ b/src/e_mod_effect.c @@ -175,8 +175,8 @@ _e_mod_effect_unref(E_Client *ec) e_pixmap_free(efc->ep); if (!e_object_unref(E_OBJECT(ec))) { - EFFINF("Effect unref efc(%p) Client free'd", - efc->ep, ec, efc); + EFFINF("Effect unref ec(%p) ep(%p) efc(%p) Client free'd", + NULL, NULL, ec, efc->ep, efc); efc->ec = NULL; efc = NULL; diff --git a/src/e_mod_effect_rotation.c b/src/e_mod_effect_rotation.c index 8a127e8..5fa3a0b 100644 --- a/src/e_mod_effect_rotation.c +++ b/src/e_mod_effect_rotation.c @@ -115,14 +115,14 @@ _rotation_effect_targets_get(Rotation_Effect *effect) if (!effect) return NULL; + if (effect->zone->display_state == E_ZONE_DISPLAY_STATE_OFF) + return NULL; + x = y = w = h = 0; t = eina_tiler_new(effect->zone->w + edge, effect->zone->h + edge); eina_tiler_tile_size_set(t, 1, 1); - if (effect->zone->display_state == E_ZONE_DISPLAY_STATE_OFF) - return NULL; - EINA_RECTANGLE_SET(&r, effect->zone->x, effect->zone->y, effect->zone->w, effect->zone->h); eina_tiler_rect_add(t, &r); @@ -147,6 +147,7 @@ _rotation_effect_targets_get(Rotation_Effect *effect) (ec->e.state.rot.ang.curr == effect->zone->rot.curr)) { if (l) eina_list_free(l); + eina_tiler_free(t); return NULL; } } @@ -161,6 +162,7 @@ _rotation_effect_targets_get(Rotation_Effect *effect) if (eina_tiler_empty(t)) break; } + eina_tiler_free(t); return l; } @@ -218,7 +220,9 @@ _rotation_effect_object_create(Evas_Object *o) w = buffer->w; h = buffer->h; + pix = wl_shm_buffer_get_data(buffer->shm_buffer); + if (!pix) goto fail; if (eobj->data_pool) wl_shm_pool_unref(eobj->data_pool); @@ -232,6 +236,8 @@ _rotation_effect_object_create(Evas_Object *o) tbm_surface_map(tbm_surface, TBM_SURF_OPTION_READ, &surface_info); data = surface_info.planes[0].ptr; + if (!data) goto fail; + w = surface_info.width; h = surface_info.height; @@ -255,6 +261,8 @@ _rotation_effect_object_create(Evas_Object *o) tbm_surface_map(tbm_surface, TBM_SURF_OPTION_READ, &surface_info); data = surface_info.planes[0].ptr; + if (!data) goto fail; + w = surface_info.width; h = surface_info.height; -- 2.7.4