summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/atom.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/atom.c b/src/atom.c
index d43ac38..925ca13 100644
--- a/src/atom.c
+++ b/src/atom.c
@@ -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);