mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
fixing bug in sexp_destroy_context
We need to grab a reference to the context heap before sweeping, in case sweeping overwrites the heap reference.
This commit is contained in:
parent
95e0b0bb31
commit
171966956f
1 changed files with 1 additions and 1 deletions
2
sexp.c
2
sexp.c
|
@ -293,8 +293,8 @@ void sexp_destroy_context (sexp ctx) {
|
||||||
sexp_heap heap, tmp;
|
sexp_heap heap, tmp;
|
||||||
size_t sum_freed;
|
size_t sum_freed;
|
||||||
if (sexp_context_heap(ctx)) {
|
if (sexp_context_heap(ctx)) {
|
||||||
sexp_sweep(ctx, &sum_freed); /* sweep w/o mark to run finalizers */
|
|
||||||
heap = sexp_context_heap(ctx);
|
heap = sexp_context_heap(ctx);
|
||||||
|
sexp_sweep(ctx, &sum_freed); /* sweep w/o mark to run finalizers */
|
||||||
sexp_context_heap(ctx) = NULL;
|
sexp_context_heap(ctx) = NULL;
|
||||||
for ( ; heap; heap=tmp) {
|
for ( ; heap; heap=tmp) {
|
||||||
tmp = heap->next;
|
tmp = heap->next;
|
||||||
|
|
Loading…
Add table
Reference in a new issue