From f98782c061e1f1718677090e4adc1c7576377b68 Mon Sep 17 00:00:00 2001 From: Yutetsu TAKATSUKASA Date: Thu, 17 Dec 2020 00:00:13 +0900 Subject: [PATCH] Tests: Fix use-after-free in fst testcases (#2709) --- include/gtkwave/fstapi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/gtkwave/fstapi.c b/include/gtkwave/fstapi.c index d311c756d..fe2320da7 100644 --- a/include/gtkwave/fstapi.c +++ b/include/gtkwave/fstapi.c @@ -1816,10 +1816,11 @@ free(xc->curval_mem); free(xc->valpos_mem); free(xc->vchg_mem); tmpfile_close(&xc->tchn_handle, &xc->tchn_handle_nam); +fstWriterContext* const parent = xc->xc_parent; free(xc); -xc->xc_parent->in_pthread = 0; -pthread_mutex_unlock(&(xc->xc_parent->mutex)); +parent->in_pthread = 0; +pthread_mutex_unlock(&(parent->mutex)); return(NULL); }