From: Felix Fietkau Date: Tue, 3 Jun 2014 22:11:03 +0000 (+0200) Subject: service: use calloc instead of malloc+memset X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=37121416de13c5cfd74635a5632f95eab4c0a3d9;p=oweals%2Fmdnsd.git service: use calloc instead of malloc+memset Signed-off-by: Felix Fietkau --- 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);