aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_map.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-05-17 13:43:33 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-05-17 15:32:04 +0900
commitba8db108cbf8a8c7d13d92a8fbe20480280bc2b6 (patch)
tree50e5ab512eb5dc70832c005da0c6caf196a3717f /src/lib/evas/canvas/evas_map.c
parentprefs: Remove some elm_prefs types from EO (diff)
downloadefl-ba8db108cbf8a8c7d13d92a8fbe20480280bc2b6.tar.gz
evas map: Fix uninitialized fields
This fixes a "jump on uninitialized value" as reported by valgrind. See evas_map.c:85: if (obj->map->cur.map->normal_geometry.x != x1) ch = 1;
Diffstat (limited to 'src/lib/evas/canvas/evas_map.c')
-rw-r--r--src/lib/evas/canvas/evas_map.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/evas/canvas/evas_map.c b/src/lib/evas/canvas/evas_map.c
index b56eb7de7f..df84657b96 100644
--- a/src/lib/evas/canvas/evas_map.c
+++ b/src/lib/evas/canvas/evas_map.c
@@ -139,7 +139,6 @@ _evas_map_init(Evas_Map *m, int count, Eina_Bool sync)
{
m->move_sync.enabled = sync;
m->count = count;
- m->persp.foc = 0;
m->alpha = 1;
m->smooth = 1;
m->magic = MAGIC_MAP;
@@ -163,7 +162,7 @@ _evas_map_new(int count, Eina_Bool sync)
alloc = (count < 4) ? 4 : count;
if (alloc & 0x1) alloc ++;
- m = malloc(sizeof(Evas_Map) + (alloc * sizeof(Evas_Map_Point)));
+ m = calloc(1, sizeof(Evas_Map) + (alloc * sizeof(Evas_Map_Point)));
if (!m) return NULL;
_evas_map_init(m, count, sync);
return m;
@@ -172,7 +171,16 @@ _evas_map_new(int count, Eina_Bool sync)
void
_evas_map_reset(Evas_Map *m)
{
+ int alloc;
+
if (!m) return;
+
+ /* Adjust allocation such that: at least 4 points, and always an even
+ * number: this allows the software engine to work efficiently */
+ alloc = (m->count < 4) ? 4 : m->count;
+ if (alloc & 0x1) alloc ++;
+
+ memset(m, 0, sizeof(Evas_Map) + (alloc * sizeof(Evas_Map_Point)));
_evas_map_init(m, m->count, m->move_sync.enabled);
}