From 171966956f4da3fc8d45e047cabef1ea1aa8f521 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Tue, 9 Mar 2010 20:23:29 +0900 Subject: [PATCH] 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. --- sexp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sexp.c b/sexp.c index b6304431..4d2baed7 100644 --- a/sexp.c +++ b/sexp.c @@ -293,8 +293,8 @@ void sexp_destroy_context (sexp ctx) { sexp_heap heap, tmp; size_t sum_freed; if (sexp_context_heap(ctx)) { - sexp_sweep(ctx, &sum_freed); /* sweep w/o mark to run finalizers */ heap = sexp_context_heap(ctx); + sexp_sweep(ctx, &sum_freed); /* sweep w/o mark to run finalizers */ sexp_context_heap(ctx) = NULL; for ( ; heap; heap=tmp) { tmp = heap->next;