Fix dereference after NULL issue 12/304412/2 accepted/tizen_unified_riscv accepted/tizen/unified/20240117.163255 accepted/tizen/unified/riscv/20240118.054547
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 17 Jan 2024 04:48:07 +0000 (13:48 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 17 Jan 2024 05:14:57 +0000 (14:14 +0900)
Change-Id: I845ecb7e7fc6b6242e755a336f0e7e1429ae4bf9
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/atom.c

index d43ac38..925ca13 100644 (file)
@@ -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);