summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_evdev.c
diff options
context:
space:
mode:
authorJean-Philippe ANDRE <jpeg@videolan.org>2015-03-25 15:29:49 -0700
committerJean-Philippe ANDRE <jpeg@videolan.org>2015-03-25 15:34:23 -0700
commit0ef41604e88b8a8224818824217ebc09c93789d5 (patch)
tree667a8d2abcc482aa9ae8deef1f7ed74aa3584ed3 /src/lib/ecore_drm/ecore_drm_evdev.c
parentf30c0ea3997e92d527d662cd9e33e76ed3fe0343 (diff)
Ecore: Use calloc() to initialize Ecore_Event_Key fully
Some fields (eg. data) may not be properly initialized. Use calloc() instead of malloc() will ensure proper initialization even if we add more fields. These fields (data) would even be passed down to Evas as Evas_Event_Key_Down for instance.
Diffstat (limited to '')
-rw-r--r--src/lib/ecore_drm/ecore_drm_evdev.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c b/src/lib/ecore_drm/ecore_drm_evdev.c
index a8383fa5c6..cbf58f3d4e 100644
--- a/src/lib/ecore_drm/ecore_drm_evdev.c
+++ b/src/lib/ecore_drm/ecore_drm_evdev.c
@@ -308,7 +308,7 @@ _device_handle_key(struct libinput_device *device, struct libinput_event_keyboar
308 308
309 if (!compose) compose = compose_buffer; 309 if (!compose) compose = compose_buffer;
310 310
311 e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + 311 e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
312 ((compose[0] != '\0') ? strlen(compose) : 0) + 3); 312 ((compose[0] != '\0') ? strlen(compose) : 0) + 3);
313 if (!e) return; 313 if (!e) return;
314 314
@@ -327,7 +327,6 @@ _device_handle_key(struct libinput_device *device, struct libinput_event_keyboar
327 e->timestamp = timestamp; 327 e->timestamp = timestamp;
328 e->same_screen = 1; 328 e->same_screen = 1;
329 e->keycode = code; 329 e->keycode = code;
330 e->data = NULL;
331 330
332 _device_modifiers_update(edev); 331 _device_modifiers_update(edev);
333 332