service: use calloc instead of malloc+memset
authorFelix Fietkau <nbd@openwrt.org>
Tue, 3 Jun 2014 22:11:03 +0000 (00:11 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 3 Jun 2014 22:11:03 +0000 (00:11 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
service.c

index 354099bd5dfe6fc04da21719712c6bd376bb1621..486a1fbcae7606c7237e60a984acee06e56c6e18 100644 (file)
--- a/service.c
+++ b/service.c
@@ -135,11 +135,10 @@ service_send_srv(struct uloop_fd *u, struct service *s)
        if (len < 1)
                return;
 
-       sd = malloc(len + sizeof(struct dns_srv_data));
+       sd = calloc(1, len + sizeof(struct dns_srv_data));
        if (!sd)
                return;
 
-       memset(sd, 0, sizeof(struct dns_srv_data));
        sd->port = cpu_to_be16(s->port);
        memcpy(&sd[1], buffer, len);
        host = service_name(s->service);