net: Fuse g_malloc(); memset() into g_new0()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Markus Armbruster 2014-12-04 14:28:16 +01:00 committed by Stefan Hajnoczi
parent 23120b13c6
commit 71e28e3cc2

View File

@ -695,8 +695,7 @@ int net_init_l2tpv3(const NetClientOptions *opts,
goto outerr;
}
s->dgram_dst = g_malloc(sizeof(struct sockaddr_storage));
memset(s->dgram_dst, '\0' , sizeof(struct sockaddr_storage));
s->dgram_dst = g_new0(struct sockaddr_storage, 1);
memcpy(s->dgram_dst, result->ai_addr, result->ai_addrlen);
s->dst_size = result->ai_addrlen;