summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcp
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-03 23:11:30 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-03 23:11:30 +0000
commitc78ac1aed8538984e5fcc1c8a2d3b7ff2135c265 (patch)
tree2e89f0700d21f963e7e13676627b90608b4e6a4b /usr.sbin/dhcp
parentdc6bee77030037d4bd185b22d995e214ae04f685 (diff)
missing or incorrect checks for malloc failure; cloder@acm.org
Diffstat (limited to 'usr.sbin/dhcp')
-rw-r--r--usr.sbin/dhcp/common/alloc.c2
-rw-r--r--usr.sbin/dhcp/sysconfd/sysconfd.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/dhcp/common/alloc.c b/usr.sbin/dhcp/common/alloc.c
index 38fe5e7536a..ad976a33d25 100644
--- a/usr.sbin/dhcp/common/alloc.c
+++ b/usr.sbin/dhcp/common/alloc.c
@@ -129,6 +129,8 @@ struct hash_table *new_hash_table(count, name)
rval = dmalloc(sizeof (struct hash_table)
- (DEFAULT_HASH_SIZE * sizeof(struct hash_bucket *))
+ (count * sizeof(struct hash_bucket *)), name);
+ if (rval == NULL)
+ return NULL;
rval->hash_count = count;
return rval;
}
diff --git a/usr.sbin/dhcp/sysconfd/sysconfd.c b/usr.sbin/dhcp/sysconfd/sysconfd.c
index 5598f7d5636..d978a0f5455 100644
--- a/usr.sbin/dhcp/sysconfd/sysconfd.c
+++ b/usr.sbin/dhcp/sysconfd/sysconfd.c
@@ -44,7 +44,7 @@
#ifndef lint
static char copyright[] =
-"$Id: sysconfd.c,v 1.3 2002/06/21 03:30:21 deraadt Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: sysconfd.c,v 1.4 2002/07/03 23:11:29 deraadt Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -140,7 +140,7 @@ void new_connection (proto)
int new_fd;
tmp = (struct sysconf_client *)malloc (sizeof *tmp);
- if (tmp < 0)
+ if (tmp == NULL)
error ("Can't find memory for new client!");
memset (tmp, 0, sizeof *tmp);