mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 15:23:02 +00:00
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.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2009-06-11 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2009-06-10 Akim Demaille <demaille@gostai.com>
|
2009-06-10 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
deterministic test suite.
|
deterministic test suite.
|
||||||
|
|||||||
@@ -120,7 +120,8 @@ muscle_insert (char const *key, char const *value)
|
|||||||
/* First insertion in the hash. */
|
/* First insertion in the hash. */
|
||||||
entry = xmalloc (sizeof *entry);
|
entry = xmalloc (sizeof *entry);
|
||||||
entry->key = key;
|
entry->key = key;
|
||||||
hash_insert (muscle_table, entry);
|
if (!hash_insert (muscle_table, entry))
|
||||||
|
xalloc_die ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
free (entry->storage);
|
free (entry->storage);
|
||||||
@@ -149,7 +150,8 @@ muscle_grow (const char *key, const char *val, const char *separator)
|
|||||||
/* First insertion in the hash. */
|
/* First insertion in the hash. */
|
||||||
entry = xmalloc (sizeof *entry);
|
entry = xmalloc (sizeof *entry);
|
||||||
entry->key = key;
|
entry->key = key;
|
||||||
hash_insert (muscle_table, entry);
|
if (!hash_insert (muscle_table, entry))
|
||||||
|
xalloc_die ();
|
||||||
entry->value = entry->storage = xstrdup (val);
|
entry->value = entry->storage = xstrdup (val);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -379,7 +379,8 @@ state_hash_free (void)
|
|||||||
void
|
void
|
||||||
state_hash_insert (state *s)
|
state_hash_insert (state *s)
|
||||||
{
|
{
|
||||||
hash_insert (state_table, s);
|
if (!hash_insert (state_table, s))
|
||||||
|
xalloc_die ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user