summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-02-24 22:02:27 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-02-24 22:02:27 +0000
commit663306ba93002c21f2b6951fe94836c31e9cdd71 (patch)
tree5a2ec0fb341251aa6e462f961af3f8ffe58980b6 /usr.sbin
parent7a117c93132ed22b1595b0a31190782096db2f0d (diff)
use calloc istead of malloc, setting sinaddr and bzero'ing it over later
found by Ward Wouts <ward@wizeazz.nl> but different fix
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/dhcp/relay/dhcrelay.c3
1 files changed, 1 insertions, 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;