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:
Akim Demaille
2009-06-11 14:42:12 +02:00
parent a887366955
commit 04d1e39dd3
3 changed files with 13 additions and 3 deletions

View File

@@ -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-11 Akim Demaille <demaille@gostai.com>
tests: honor TESTSUITEFLAGS in every check target.

View File

@@ -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

View File

@@ -379,7 +379,8 @@ state_hash_free (void)
void
state_hash_insert (state *s)
{
hash_insert (state_table, s);
if (!hash_insert (state_table, s))
xalloc_die ();
}