]> git.saurik.com Git - bison.git/commitdiff
hash: check insertion for memory exhaustion.
authorAkim Demaille <demaille@gostai.com>
Thu, 25 Jun 2009 04:03:18 +0000 (06:03 +0200)
committerAkim Demaille <demaille@gostai.com>
Thu, 25 Jun 2009 04:57:26 +0000 (06:57 +0200)
* src/uniqstr.c (uniqstr_new): New.

ChangeLog
src/uniqstr.c

index 6b155a4fd6fac581d99847f97fef4d571290e5a8..78bab291aa26f5c3091bd6eba6b914e36f192b33 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-25  Akim Demaille  <demaille@gostai.com>
+
+       hash: check insertion for memory exhaustion.
+       * src/uniqstr.c (uniqstr_new): New.
+
 2009-06-11  Akim Demaille  <demaille@gostai.com>
 
        hash: check insertion for memory exhaustion.
 2009-06-11  Akim Demaille  <demaille@gostai.com>
 
        hash: check insertion for memory exhaustion.
index 644477bed20a89801e5782082c3ccbc245cd4712..78b8a98d1aa99e2876b01151fb562034ae015120 100644 (file)
@@ -1,6 +1,6 @@
 /* Keep a unique copy of strings.
 
 /* Keep a unique copy of strings.
 
-   Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -47,7 +47,8 @@ uniqstr_new (char const *str)
     {
       /* First insertion in the hash. */
       res = xstrdup (str);
     {
       /* First insertion in the hash. */
       res = xstrdup (str);
-      hash_insert (uniqstrs_table, res);
+      if (!hash_insert (uniqstrs_table, res))
+        xalloc_die ();
     }
   return res;
 }
     }
   return res;
 }