bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] master: hash: check insertion for memory exhaustion.


From: Akim Demaille
Subject: [PATCH] master: hash: check insertion for memory exhaustion.
Date: Thu, 25 Jun 2009 06:03:18 +0200

        * src/uniqstr.c (uniqstr_new): New.
---
 ChangeLog     |    5 +++++
 src/uniqstr.c |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d3980f5..a8834a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-25  Akim Demaille  <address@hidden>
+
+       hash: check insertion for memory exhaustion.
+       * src/uniqstr.c (uniqstr_new): New.
+
 2009-06-24  Akim Demaille  <address@hidden>
 
        variables: rename namespace as api.namespace.
diff --git a/src/uniqstr.c b/src/uniqstr.c
index 644477b..78b8a98 100644
--- a/src/uniqstr.c
+++ b/src/uniqstr.c
@@ -1,6 +1,6 @@
 /* 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.
 
@@ -47,7 +47,8 @@ uniqstr_new (char const *str)
     {
       /* First insertion in the hash. */
       res = xstrdup (str);
-      hash_insert (uniqstrs_table, res);
+      if (!hash_insert (uniqstrs_table, res))
+        xalloc_die ();
     }
   return res;
 }
-- 
1.6.3.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]