]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Don't malloc space for hash name
authorTed Lemon <source@isc.org>
Wed, 28 Aug 1996 01:39:20 +0000 (01:39 +0000)
committerTed Lemon <source@isc.org>
Wed, 28 Aug 1996 01:39:20 +0000 (01:39 +0000)
common/hash.c
hash.c

index ccff48ea71b342d5054b2c968a05e1d0b35c66c7..668c4cfdadc455db0811515483d4d6868be59a44 100644 (file)
@@ -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 ccff48ea71b342d5054b2c968a05e1d0b35c66c7..668c4cfdadc455db0811515483d4d6868be59a44 100644 (file)
--- 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;