Work on addressing #1337 - fix valgrind case.

This commit is contained in:
Calvin Rose 2023-12-18 08:56:27 -06:00
parent a10b4f61d8
commit 11d7af3f95
2 changed files with 7 additions and 1 deletions

View File

@ -233,8 +233,8 @@ const uint8_t *janet_symbol_gen(void) {
head->length = sizeof(janet_vm.gensym_counter) - 1;
head->hash = hash;
sym = (uint8_t *)(head->data);
sym[head->length] = 0;
memcpy(sym, janet_vm.gensym_counter, sizeof(janet_vm.gensym_counter));
sym[head->length] = 0;
janet_symcache_put((const uint8_t *)sym, bucket);
return (const uint8_t *)sym;
}

View File

@ -366,4 +366,10 @@
(exec-slurp ;run janet "-e" "(print :hi)")))
"exec-slurp 1"))
# valgrind-able check for #1337
(def superv (ev/chan 10))
(def f (ev/go |(ev/sleep 1e9) nil superv))
(ev/cancel f (gensym))
(ev/take superv)
(end-suite)