mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
wayland-client: Initialize newly created wl_proxys to zero
Up until now, newly created wl_proxys (with proxy_create or wl_proxy_create_for_id) are not initialized properly after memory allocation. The wl_display object in contrast is. To prevent giving uninitialized data to the user (e.g. user_data) an appropriate memset has been added. Also, after a memset members don't have to be explicitly initialized with zero anymore. Signed-off-by: Nils Chr. Brause <nilschrbrause@googlemail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
fb97550ce6
commit
5c7d30b691
1 changed files with 4 additions and 6 deletions
|
|
@ -270,12 +270,11 @@ proxy_create(struct wl_proxy *factory, const struct wl_interface *interface)
|
|||
if (proxy == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(proxy, 0, sizeof *proxy);
|
||||
|
||||
proxy->object.interface = interface;
|
||||
proxy->object.implementation = NULL;
|
||||
proxy->dispatcher = NULL;
|
||||
proxy->display = display;
|
||||
proxy->queue = factory->queue;
|
||||
proxy->flags = 0;
|
||||
proxy->refcount = 1;
|
||||
|
||||
proxy->object.id = wl_map_insert_new(&display->objects, 0, proxy);
|
||||
|
|
@ -327,13 +326,12 @@ wl_proxy_create_for_id(struct wl_proxy *factory,
|
|||
if (proxy == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(proxy, 0, sizeof *proxy);
|
||||
|
||||
proxy->object.interface = interface;
|
||||
proxy->object.implementation = NULL;
|
||||
proxy->object.id = id;
|
||||
proxy->dispatcher = NULL;
|
||||
proxy->display = display;
|
||||
proxy->queue = factory->queue;
|
||||
proxy->flags = 0;
|
||||
proxy->refcount = 1;
|
||||
|
||||
wl_map_insert_at(&display->objects, 0, id, proxy);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue