From 37121416de13c5cfd74635a5632f95eab4c0a3d9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 4 Jun 2014 00:11:03 +0200 Subject: [PATCH] service: use calloc instead of malloc+memset Signed-off-by: Felix Fietkau --- service.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/service.c b/service.c index 354099b..486a1fb 100644 --- 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); -- 2.11.0