Use zalloc instead of malloc + memset

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
This commit is contained in:
Jonas Ådahl 2015-08-26 12:00:06 +08:00
parent 3de1783e50
commit 2e7fb78682
5 changed files with 15 additions and 18 deletions

View file

@ -415,11 +415,10 @@ wl_client_create(struct wl_display *display, int fd)
struct wl_client *client;
socklen_t len;
client = malloc(sizeof *client);
client = zalloc(sizeof *client);
if (client == NULL)
return NULL;
memset(client, 0, sizeof *client);
client->display = display;
client->source = wl_event_loop_add_fd(display->loop, fd,
WL_EVENT_READABLE,
@ -854,11 +853,10 @@ wl_socket_alloc(void)
{
struct wl_socket *s;
s = malloc(sizeof *s);
s = zalloc(sizeof *s);
if (!s)
return NULL;
memset(s, 0, sizeof *s);
s->fd = -1;
s->fd_lock = -1;