summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2024-04-04 12:21:26 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2024-04-04 12:24:22 +0200
commita0d646fb9f3945d98586b15d157dbb909843f06c (patch)
treec08a05c3d755a6d6e8e75919978e78c5e9bff008
parent57e78f2d49a5b1a2337a15254e7b8c87aa63c83a (diff)
downloademacs-a0d646fb9f3945d98586b15d157dbb909843f06c.tar.gz
emacs-a0d646fb9f3945d98586b15d157dbb909843f06c.tar.bz2
emacs-a0d646fb9f3945d98586b15d157dbb909843f06c.zip
* src/json.c (make_symset_table): Fix over-large allocation size.
We multiplied when we should have added. Oops.
-rw-r--r--src/json.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c
index 33c3289b394..702350b1b09 100644
--- a/src/json.c
+++ b/src/json.c
@@ -143,7 +143,7 @@ make_symset_table (int bits, struct symset_tbl *up)
int maxbits = min (SIZE_WIDTH - 2 - (word_size < 8 ? 2 : 3), 32);
if (bits > maxbits)
memory_full (PTRDIFF_MAX); /* Will never happen in practice. */
- struct symset_tbl *st = xnmalloc (sizeof *st->entries << bits, sizeof *st);
+ struct symset_tbl *st = xmalloc (sizeof *st + (sizeof *st->entries << bits));
st->up = up;
ptrdiff_t size = symset_size (bits);
for (ptrdiff_t i = 0; i < size; i++)