summaryrefslogtreecommitdiff
path: root/src/muscle-tab.c
diff options
context:
space:
mode:
authorAkim Demaille <demaille@gostai.com>2009-06-11 14:42:12 +0200
committerAkim Demaille <demaille@gostai.com>2009-06-11 14:42:12 +0200
commit04d1e39dd35c7a5c9e7b12c12a7afbedee71ea96 (patch)
treed1eaf52905c0e58c8b3cc56557ddacd95df43b33 /src/muscle-tab.c
parenta8873669551e28e368923d3c6183b5b08946ae02 (diff)
downloadbison-04d1e39dd35c7a5c9e7b12c12a7afbedee71ea96.tar.gz
hash: check insertion for memory exhaustion.
* src/muscle-tab.c (muscle_insert, muscle_grow) * src/state.c (state_hash_insert): Check the return value of hash_insert.
Diffstat (limited to 'src/muscle-tab.c')
-rw-r--r--src/muscle-tab.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/muscle-tab.c b/src/muscle-tab.c
index c410a551..c78e3f8d 100644
--- a/src/muscle-tab.c
+++ b/src/muscle-tab.c
@@ -120,7 +120,8 @@ muscle_insert (char const *key, char const *value)
/* First insertion in the hash. */
entry = xmalloc (sizeof *entry);
entry->key = key;
- hash_insert (muscle_table, entry);
+ if (!hash_insert (muscle_table, entry))
+ xalloc_die ();
}
else
free (entry->storage);
@@ -149,7 +150,8 @@ muscle_grow (const char *key, const char *val, const char *separator)
/* First insertion in the hash. */
entry = xmalloc (sizeof *entry);
entry->key = key;
- hash_insert (muscle_table, entry);
+ if (!hash_insert (muscle_table, entry))
+ xalloc_die ();
entry->value = entry->storage = xstrdup (val);
}
else