From: Ted Lemon Date: Wed, 28 Aug 1996 01:39:20 +0000 (+0000) Subject: Don't malloc space for hash name X-Git-Tag: BETA_5~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8dd2f2b59f559c443a7c2f23dc6d4a2aa29eb80e;p=thirdparty%2Fdhcp.git Don't malloc space for hash name --- diff --git a/common/hash.c b/common/hash.c index ccff48ea7..668c4cfda 100644 --- a/common/hash.c +++ b/common/hash.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: hash.c,v 1.7 1996/08/27 09:49:53 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: hash.c,v 1.8 1996/08/28 01:39:20 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -108,15 +108,7 @@ void add_hash (table, name, len, pointer) warn ("Can't add %s to hash table.", name); return; } - bp -> name = malloc (len ? len : strlen (name) + 1); - if (!bp -> name) { - warn ("Can't add %s to hash table.", name); - free_hash_bucket (bp, "add_hash"); - } - if (len) - memcpy (bp -> name, name, len); - else - strcpy (bp -> name, name); + bp -> name = name; bp -> value = pointer; bp -> next = table -> buckets [hashno]; bp -> len = len; diff --git a/hash.c b/hash.c index ccff48ea7..668c4cfda 100644 --- a/hash.c +++ b/hash.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: hash.c,v 1.7 1996/08/27 09:49:53 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: hash.c,v 1.8 1996/08/28 01:39:20 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -108,15 +108,7 @@ void add_hash (table, name, len, pointer) warn ("Can't add %s to hash table.", name); return; } - bp -> name = malloc (len ? len : strlen (name) + 1); - if (!bp -> name) { - warn ("Can't add %s to hash table.", name); - free_hash_bucket (bp, "add_hash"); - } - if (len) - memcpy (bp -> name, name, len); - else - strcpy (bp -> name, name); + bp -> name = name; bp -> value = pointer; bp -> next = table -> buckets [hashno]; bp -> len = len;