diff options
-rw-r--r-- | src/atom.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -148,6 +148,9 @@ atom_intern(struct atom_table *table, const char *string, size_t len, bool add) if (darray_size(table->strings) > 0.80 * table->index_size) { table->index_size *= 2; table->index = realloc(table->index, table->index_size * sizeof(*table->index)); + if (!table->index) + return XKB_ATOM_NONE; + memset(table->index, 0, table->index_size * sizeof(*table->index)); for (size_t j = 1; j < darray_size(table->strings); j++) { const char *s = darray_item(table->strings, j); |