From 663306ba93002c21f2b6951fe94836c31e9cdd71 Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Tue, 24 Feb 2004 22:02:27 +0000 Subject: use calloc istead of malloc, setting sinaddr and bzero'ing it over later found by Ward Wouts but different fix --- usr.sbin/dhcp/relay/dhcrelay.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr.sbin/dhcp/relay/dhcrelay.c b/usr.sbin/dhcp/relay/dhcrelay.c index 2f5b591e589..8bfa72c61fe 100644 --- a/usr.sbin/dhcp/relay/dhcrelay.c +++ b/usr.sbin/dhcp/relay/dhcrelay.c @@ -146,7 +146,7 @@ int main (argc, argv) } } if (iap) { - sp = (struct server_list *)malloc (sizeof *sp); + sp = calloc(1, sizeof *sp); if (!sp) error ("no memory for server.\n"); sp -> next = servers; @@ -186,7 +186,6 @@ int main (argc, argv) /* Set up the server sockaddrs. */ for (sp = servers; sp; sp = sp -> next) { - memset(&sp->to, 0, sizeof(sp->to)); sp -> to.sin_port = local_port; sp -> to.sin_family = AF_INET; sp -> to.sin_len = sizeof sp -> to; -- cgit v1.2.3